FileReader/FileWriter复制文件

public class Test{

/*FileReader/FileWriter读写乱码,待处理*/

public static void main(String[] args) throws IOException{
FileReader fileReader = null;
FileWriter fileWriter = null;
try{
fileReader = new FileReader("c:/123/666.doc");
fileWriter = new FileWriter("c:/123/999.doc");
int len = 0;
char[] buffer = new char[1024];
while((len=fileReader.read(buffer))!=-1){
fileWriter.write(buffer, 0, len);
}
}catch (Exception e) {
e.printStackTrace();
}finally{
fileReader.close();
fileWriter.close();
}
}

}

posted @ 2016-07-01 15:58  N神3  阅读(212)  评论(0编辑  收藏  举报