import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileReader;
import java.io.FileWriter;
// 通过缓冲区赋值文件
public class CopyTextByBuf {
public static void main(String[] args) throws Exception {
BufferedReader bufferedReader = new BufferedReader(
new FileReader("E:\\index_banner.ftl"));
BufferedWriter bufferedWriter = new BufferedWriter(
new FileWriter("F:\\index_banner_copy.ftl"));
String line;
while ((line = bufferedReader.readLine()) != null) {
bufferedWriter.write(line);
bufferedWriter.newLine();
}
bufferedWriter.flush();
bufferedWriter.close();
bufferedReader.close();
}
}
readLine的原理图例
网友评论