⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 files.java

📁 “JSP数据库项目案例导航”一书从第一章到第十一章各章实例的源程序文件以及数据库文件。 注意: 1. 本书中的案例提供的数据库环境不同
💻 JAVA
字号:
///////////////////////////////////////////////////////////
// DeJaved by mDeJava v1.0. Copyright 1999 MoleSoftware. //
//       To download last version of this software:      //
//            http://molesoftware.hypermatr.net          //
//               e-mail:molesoftware@mail.ru             //
///////////////////////////////////////////////////////////

package com.jspsmart.upload;

import java.io.IOException;
import java.util.*;

// Referenced classes of package com.jspsmart.upload:
//            File, SmartUpload

public class Files
{

    private SmartUpload m_parent = null;
    private Hashtable m_files = null;
    private int m_counter = 0;

    Files()
    {
        m_files = new Hashtable();
        m_counter = 0;
    }

    protected void addFile(File file)
    {
        if(file == null)
        {
            throw new IllegalArgumentException("newFile cannot be null.");
        }
        else
        {
            m_files.put(new Integer(m_counter), file);
            m_counter++;
            return;
        }
    }

    public File getFile(int i)
    {
        if(i < 0)
            throw new IllegalArgumentException("File's index cannot be a negative value (1210).");
        File file = (File)m_files.get(new Integer(i));
        if(file == null)
            throw new IllegalArgumentException("Files' name is invalid or does not exist (1205).");
        else
            return file;
    }

    public int getCount()
    {
        return m_counter;
    }

    public long getSize()
        throws IOException
    {
        long l = 0L;
        for(int i = 0; i < m_counter; i++)
            l += getFile(i).getSize();

        return l;
    }

    public Collection getCollection()
    {
        return m_files.values();
    }

    public Enumeration getEnumeration()
    {
        return m_files.elements();
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -