ArrayList<FileInputStream> al = new ArrayList<FileInputStream>();
//定义iterator迭代器
Iterator<String> it = fileName.iterator();
//遍历集合元素,将存有文件地址的集合元素存进接收FileInputStream类型的集合中
while(it.hasNext())
al.add(new FileInputStream(it.next()));
//创建实现Enumeration接口的对象
final Iterator<FileInputStream> it1 = al.iterator();
Enumeration<FileInputStream> en = new Enumeration<FileInputStream>(){
public boolean hasMoreElements(){
return it1.hasNext();
}
public FileInputStream nextElement(){
return it1.next();
}
};作者: 程序爱好者 时间: 2014-4-28 15:44