SequenceInputStream(InputStream, InputStream)
FileInputStream fis1 = new FileInputStream("a.txt");
FileInputStream fis2 = new FileInputStream("b.txt");
SequenceInputStream sis = new SequenceInputStream(fis1, fis2); //将两个流整合成一个流
FileOutputStream fos = new FileOutputStream("c.txt"); //创建输出流对象,关联c.txt
int b;
while((b = sis.read()) != -1) { //用整合后的读
fos.write(b); //写到指定文件上
}
sis.close();
fos.close(); |
|