package com.huyd.day20;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.SequenceInputStream;
import java.util.Vector;
public class SequenceDemo {
public static void main(String[] args) {
Vector<FileInputStream> v=new Vector<FileInputStream>();
try {
v.add(new FileInputStream("1.txt"));
v.add(new FileInputStream("2.txt"));
v.add(new FileInputStream("3.txt"));
} catch (IOException e) {
e.printStackTrace();
}
SequenceInputStream sis=new SequenceInputStream(v.elements());
try {
FileOutputStream fo=new FileOutputStream("4.txt");
try {
int i=0;
while((i=sis.read())!=-1){
fo.write(i);
}
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.SequenceInputStream;
import java.util.Vector;
public class SequenceDemo {
public static void main(String[] args) {
Vector<FileInputStream> v=new Vector<FileInputStream>();
try {
v.add(new FileInputStream("1.txt"));
v.add(new FileInputStream("2.txt"));
v.add(new FileInputStream("3.txt"));
} catch (IOException e) {
e.printStackTrace();
}
SequenceInputStream sis=new SequenceInputStream(v.elements());
try {
FileOutputStream fo=new FileOutputStream("4.txt");
try {
int i=0;
while((i=sis.read())!=-1){
fo.write(i);
}
} catch (IOException e) {
e.printStackTrace();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
}
}
}