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();

 }

 

 

posted @ 2020-07-01 22:17  一块  阅读(137)  评论(0编辑  收藏  举报