首页 > 其他 > 详细

FileCpoy --- 代码

时间:2017-07-05 12:29:54      阅读:473      评论:0      收藏:0      [点我收藏+]

import java.io.* ;

public class FileCopy {
public static void main(String[] args) {
String inputFile = "D:/java03/day23/Test.txt" ;
String outputFile = "D:/LX/Test.txt" ;

FileReader r = null;
FileWriter w = null;

try {
r = new FileReader(new File(inputFile));
w = new FileWriter(new File(outputFile));
int b = 0;

while((b = r.read()) != -1) {
w.write(b);
}
w.flush();

}catch(FileNotFoundException ex) {
ex.printStackTrace();
}catch(IOException ex) {
ex.printStackTrace();
}finally {
try{
r.close();
w.close();
}catch(IOException ex) {
ex.printStackTrace();
}
}
System.out.println("复制完成!");

}
}

FileCpoy --- 代码

原文:http://www.cnblogs.com/xuewuzhijing95hao/p/7120386.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!