java.io.RandomAccessFile in=new java.io.RandomAccessFile("E:\\temp\\Apache.txt","r");
String str=null;
while( (str=in.readLine())!=null ){
System.out.println(new String(str.getBytes("iso-8859-1")));
}
String str=null;
while( (str=in.readLine())!=null ){
System.out.println(new String(str.getBytes("iso-8859-1")));
}
File fileName=fileChooser.getSelectedFile();
BufferedReader r=new BufferedReader(new FileReader(fileName));
直接可以读取中文。
文本文件中某行可能是空行,怎样从头搜索到文件的末尾?用readLine()一行行读无法判断,可能中间为null.