字符缓冲流
2019-06-25 本文已影响0人
kanaSki
BufferedReader和BufferedWriter
二者有特有方法:
BufferedReader String readLine() 读一行文字
BufferedWriter void newLine() 写一换行符
try (BufferedReader bis = new BufferedReader(new FileReader("test.txt"));) {
String s = null;
// 读到文件末尾后会返回null
while ((s = bis.readLine()) != null) {
System.out.println(s);
}
} catch (Exception ex) {
ex.printStackTrace();
}