package stream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
public class TestReader {
public static void main(String[] args) {
BufferedReader br=null;
PrintWriter out=null;
try {
br=new BufferedReader(new FileReader("D:\\JAVA SE\\temp\\main.txt"));
out =new PrintWriter(new BufferedWriter(new FileWriter("D:\\JAVA SE\\temp\\main的new.txt")),true);
String str=null;
while((str=br.readLine())!=null){
out.println(str);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}finally{
if(br!=null)
try {
br.close();
} catch (IOException e) {
e.printStackTrace();
}
if(out!=null) out.close();
}
}
}
Java_io_PrintWriter和BufferedReader
原文:http://www.cnblogs.com/hjs775756009/p/6223992.html