67,513
社区成员
发帖
与我相关
我的任务
分享
InputStream is1 = null;
InputStream is2 = null;
OutputStream os = null;
SequenceInputStream sis = null; //合并流
try {
is1 = new FileInputStream("f:" + File.separator + "a.doc");
is2 = new FileInputStream("f:" + File.separator + "b.doc");
os = new FileOutputStream("f:" + File.separator + "ab.doc");
sis = new SequenceInputStream(is1,is2);
int temp = 0;
while((temp = sis.read())!=-1){
os.write(temp);
}
sis.close();
is1.close();
is2.close();
os.close();
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}