- <p>import java.io.*;
- import java.util.*;
- class SequenceDemo
- {
- public static void main(String[] args) throws IOException
- {
- Vector<FileInputStream> v = new Vector<FileInputStream>();</p><p> v.add(new FileInputStream("c:\\1.txt"));
- v.add(new FileInputStream("c:\\2.txt"));
- v.add(new FileInputStream("c:\\3.txt"));</p><p> Enumeration<FileInputStream> en = v.elements();//返回此向量的组件的枚举。</p><p> SequenceInputStream sis = new SequenceInputStream(en);</p><p> FileOutputStream fos = new FileOutputStream("c:\\4.txt");</p><p> byte[] buf = new byte[1024];</p><p> int len = 0;</p><p> while ((len=sis.read(buf))!=-1)
- {
- fos.write(buf,0,len);
- }
-
- fos.close();
- sis.close();
-
- }
- }</p>
- <p> </p>
复制代码 本程序运行时出先如下错误:Exception in thread "main" java.io.FileNotFoundException: c:\1.txt (系统找定的文件。)
谁帮忙看看错在哪了?找了很长时间一直没找到。
|
|