标签:
字符流:FileReader和BufferedReader的使用
String path = "C:\\Users\\ben\\Desktop\\readerTest.txt";
FileReader :
FileReader fileReader = new FileReader(path)
char[] buf = new char[1024];
fileReader.read(buf)
System.out.println(new String(buf, 0, temp))
BufferedReader:
BufferedReader bufferedReader = new BufferedReader(path);
String line = bufferedreader.readLine(); //一行一行读取文本
System.out.println(line)
区别:BufferedReader,可以先放进缓存区,适用于纯文本的
标签:
原文地址:http://www.cnblogs.com/isisbenben/p/5885031.html