<span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">合并流顾名思义,就是将两个输入流合并成一个流进行输出,具体看看怎么用吧</span>
:
package excise;
import java.io.File;
import java.io.FileInputStream;
import java.io.SequenceInputStream;
import java.io.OutputStream;
import java.io.FileOutputStream;
public class SequenceInputStreamDemo {
public static void main(String args[])throws Exception{
File f1=new File("D:"+File.separator+"result.txt");
File f2=new File("D:"+File.separator+"AAAA.txt");
OutputStream os=new FileOutputStream(new File("D:"+File.separator+"combine.txt"));
SequenceInputStream sis=new SequenceInputStream(new FileInputStream(f1),new FileInputStream(f2));
int temp=0;
while((temp=sis.read())!=-1){
os.write(temp);
}
os.close();
sis.close();
}
}