import java.io.*; public class TestFileOutputStream{ public static void main(String[] args){ try{ FileOutputStream out = new FileOutputStream("D:/Java/TestFileOutputStream/copy.txt"); FileInputStream in = new FileInputStream("D:/Java/TestFileOutputStream/TestFileOutputStream.java"); int b = 0; while((b = in.read()) != -1){ out.write(b); } out.flush(); out.close(); in.close(); } catch(FileNotFoundException e){ e.printStackTrace(); } catch(IOException e){ e.printStackTrace(); } } }
原文地址:https://www.cnblogs.com/yxfyg/p/12394663.html
时间: 2024-10-12 23:50:10