标签:except 一个 str 缓冲 stat ring lin reader class
public class Demo4_Buffered(){
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader (new FileRead("xxx.txt"));
String line;
while((line = br.readLine()) != null){ //整行读取
syso(line);
}
br.close();
}
}
public class Demo5_Buffered(){
public static void main(String[] args) throws IOException{
BufferedReader br = new BufferedReader (new FileRead("xxx.txt"));
BufferedWriter bw = new BufferedWriter (new FileWriter("aaa.txt"));
String line;
while((line = br.readLine()) != null){ //整行读取
bw.writer(line);
bw.newLine(); //写出回车换行符 和bw.write("\r\n");一个效果,但是newLine()是支持各种操作平台的
}
br.close();
bw.close();
}
}
IO流,带缓冲区的流中的特殊方法:readLine()和newLine()方法。
标签:except 一个 str 缓冲 stat ring lin reader class
原文地址:https://www.cnblogs.com/wangffeng293/p/13179402.html