标签:
package filestream; import java.io.FileInputStream; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class ByteStreamTester { public static void main(String [] args) { FileInputStream in = null; FileOutputStream out = null; String path = "E:\\java\\"; try { in = new FileInputStream(path+"IOFile.txt"); out = new FileOutputStream(path+"IOFile_copy.txt"); int c; while ((c=in.read())!=-1) { out.write(c); } } catch(FileNotFoundException e) { e.printStackTrace(); } catch(IOException e) { e.printStackTrace(); } finally { try { if(in!=null) in.close(); if(out!=null) out.close(); } catch(IOException e) { e.printStackTrace(); } } } }
标签:
原文地址:http://www.cnblogs.com/ghmgm/p/4354778.html