日期:2014-05-18 浏览次数:20831 次
package Stream;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
public class test2 {
/**
* char stream
*/
public static void main(String[] args) {
FileReader myFile = null;
BufferedReader buff = null;
try{
myFile = new FileReader("abc.txt");
buff = new BufferedReader(myFile);
boolean eof = false;
while(!eof){
String string = buff.readLine();
if(string==null)
eof=true;
else
System.out.println(string);
}
}catch(IOException e){
e.printStackTrace();
}
finally{
try{
myFile.close();
buff.close();
}catch(Exception e){
e.printStackTrace();
}
}
}
}