字节流:inputStream,outputStream;
字符流:reader,writer;
方法1:
FileInputStream fis = new FileInputStream("D:/in.txt");
InputStreamReader isr = new InputStreamReader(fis);
BufferedReader br = new BufferedReader(isr);
String s = br.readline();
while(s != null) {
System.out.println(s);
s = br.readline();
}
方法2:
<pre name="code" class="java">FileReader fr = new FileReader("D:/in.txt");
BufferedReader br = new BufferedReader(fr);
String s = br.readLine();
while(s != null) {
System.out.println(s);
s = br.readLine();
}