- public static void main(String[] args) throws IOException {
- ArrayList<FileInputStream> al = new ArrayList<FileInputStream>();
-
- for(int x=1; x<=3; x++){
- al.add(new FileInputStream(x+".txt"));
- }
-
- Enumeration<FileInputStream> en = Collections.enumeration(al);
-
-
- SequenceInputStream sis = new SequenceInputStream(en);
-
- FileOutputStream fos = new FileOutputStream("444.txt");
-
- byte[] buf = new byte[1024];
-
- int len = 0;
- while((len=sis.read(buf))!=-1){
- fos.write(buf,0,len);
- }
-
- fos.close();
- sis.close();
-
- }
- }
复制代码 |