javaee IO流打印一行的方式

package Dayin;

import java.io.BufferedReader;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.PrintWriter;

public class Demo04 {

    public static void main(String[] args) throws IOException {
        //打印流 的复制
        //1、数据源:BufferedReader+FileReader
        //2、目的地:PrintWriter+Println自动刷新功能
        FileReader fr=new FileReader("d:\java\ok.txt");
        BufferedReader br=new BufferedReader(fr);
        FileOutputStream fos=new FileOutputStream("e:\java\ok.txt");
        PrintWriter pw=new PrintWriter(fos,true);
        String str=null;
        while((str=br.readLine())!=null){
            pw.println(str);          
        }
        pw.close();
    }

}
原文地址:https://www.cnblogs.com/hankai2735/p/9224807.html