日期:2014-05-20 浏览次数:20874 次
import java.io.*; public class TestFileOutPutStream { public static void main(String[] args) { int b = 0; FileInputStream in = null; FileOutputStream out = null; try { in = new FileInputStream("j:/TestFileOutPutStream.java"); out = new FileOutputStream("j:/TestFileCopy.java"); while((b=in.read())!=-1) { //out.write(b); System.out.print((char)b); } in.close(); out.close(); } catch(FileNotFoundException e) { System.out.println(" 找不到指定文件"); System.exit(-1); } catch(IOException e1) { System.out.println("文件复制错误"); System.exit(-1); } System.out.println("文件已复制"); } }