?? files.java
字號:
//***********************************************
//Copyright 2002 by BHH丂All Rights Reverved.
//
//僔僗僥儉柤 :BestProject
//僒僽僔僗僥儉柤 :忈奞娗棟
//
//===============================================
//version 曄峏擔 曄峏幰 曄峏撪梕
//-----------------------------------------------
//01-00 2002.1.21 丂棝埞愇 峏怴嶌惉
package bestproject.upload;
import java.io.*;
import java.util.*;
public class Files {
Files() {
m_files = new Hashtable();
m_counter = 0;
}
/**
*僼傽僀儖儕僗僩偵僼傽僀儖傪揧晅偡傞
*@param newFile File
*@since 01-00
*/
protected void addFile(File newFile) {
if (newFile == null) {
throw new IllegalArgumentException("newFile cannot be null.");
}
else {
m_files.put(new Integer(m_counter), newFile);
m_counter++;
return;
}
}
/**
*僼傽僀儖儕僗僩偵僼傽僀儖傪庢傞
*@param index int
*@return File
*@since 01-00
*/
public File getFile(int index) {
if (index < 0) {
throw new IllegalArgumentException(
"File's index cannot be a negative value (1210).");
}
File retval = (File) m_files.get(new Integer(index));
if (retval == null) {
throw new IllegalArgumentException(
"Files' name is invalid or does not exist (1205).");
}
else {
return retval;
}
}
/**
*僼傽僀儖儕僗僩偵僼傽僀儖偺悢傪庢傞
*@return int
*@since 01-00
*/
public int getCount() {
return m_counter;
}
/**
*僼傽僀儖儕僗僩偵僼傽僀儖挿偝傪庢傞
*@return long
*@since 01-00
*@throws IOException
*/
public long getSize() throws IOException {
long tmp = 0L;
for (int i = 0; i < m_counter; i++) {
tmp += getFile(i).getSize();
}
return tmp;
}
/**
*僼傽僀儖儕僗僩偵僼傽僀儖廤傪庢傞
*@return Collection
*@since 01-00
*/
public Collection getCollection() {
return m_files.values();
}
/**
*僼傽僀儖儕僗僩偵僼傽僀儖尦傪庢傞
*@return Enumeration
*@since 01-00
*/
public Enumeration getEnumeration() {
return m_files.elements();
}
private FileUpload m_parent;
private Hashtable m_files;
private int m_counter;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -