IO流,整合多个流。
public static void main(string[] args){
FileInputStream fis1 = new FileInputStream (a.txt);
FileInputStream fis1 = new FileInputStream (b.txt);
FileInputStream fis1 = new FileInputStream (a.txt);
FileInputStream fis1 = new FileInputStream (b.txt);
Vector<FileInputStream> v = new Vector<>(); //创建集合对象
v.add(); //将流对象存储进来
v.add();
v.add();
v.add();
Enumeration<FileInputStream> en = v.elements();
SequenceInputStream sif = new SquenceInputStream(en); //将枚举中的输入流整合成一个
FileOutputStream fos = new FileOutputStream ("d.txt");
int b;
while(( b = sif.read() != -1){
fos.write(b);
}
sif.close();
fos.cloes();
}
添加微信进交流群: opiopi293