import java.util.*;
public class SequenceDemo {
/**
* 序列流
*
把多文件合并成一个文件
*/
public static void main(String[] args) throws IOException {
Vector<FileInputStream> vector= new Vector<FileInputStream>();
vector.add(new FileInputStream("D:\\Exam\\EmailDao.java"));
vector.add(new FileInputStream("D:\\Exam\\UserDao.java"));
vector.add(new FileInputStream("D:\\Exam\\EmailDaoImpl.java"));
Enumeration<FileInputStream> en= vector.elements();//返回此向量的组件的枚举。
SequenceInputStream sqi= new SequenceInputStream(en);
//目的地
FileOutputStream fo= new FileOutputStream("D:\\office.java");
byte [] bt = new byte[1024];
int len=0;
while((len=sqi.read(bt))!=-1)
{
fo.write(bt, 0, len);
}
fo.close();
sqi.close();
}
}