Java快速複製文件

FileInputStream fis = new FileInputStream(“D:/test.txt”);
FileOutputStream fos = new FileOutputStream("C:/test.txt");
FileChannel fc1 = fis.getChannel();
FileChannel fc2 = fos.getChannel();
fc2.transferFrom(fc1, 0, fc1.size());
fc1.close();
fc2.close();
fis.close();
fos.close();
發佈了30 篇原創文章 · 獲贊 7 · 訪問量 4萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章