复制Java文件打印流改进版
package com.czie.iot1913.lps.IO.System;
import java.io.*;
/**
* FileName: PrintStream
* Author: lps
* Date: 2022/3/28 13:41
* Sign:刘品水 Q:1944900433
*/
public class PrintStreamDemo001 {
public static void main(String[] args) throws IOException {
/* BufferedReader br = new BufferedReader(new FileReader("F:\\JavaCode\\ConversionStreamDemo.java"));
BufferedWriter bw = new BufferedWriter(new FileWriter("F:\\JavaCode\\Copy.java"));
String line;
while ((line= br.readLine())!=null){
bw.write(line);
bw.newLine();
bw.flush();
}
br.close();
bw.close();*/
BufferedReader br = new BufferedReader(new FileReader("F:\\JavaCode\\ConversionStreamDemo.java"));
PrintWriter pw = new PrintWriter(new FileWriter("F:\\JavaCode\\Copy.java"),true);
String line;
while ((line= br.readLine())!=null){
pw.println(line);
}
br.close();
pw.close();
}
}