5:高效字符流的特殊复制文本文件方式
BufferedReader br = new BufferedReader(new FileReader(
"FileOutputStreamDemo.java"));
BufferedWriter bw = new BufferedWriter(new FileWriter("Copy.java"));
String line = null;
while((line=br.readLine())!=null){
bw.write(line);
bw.newLine();
bw.flush();
}
bw.close();
br.close(); |
|