我的部分代码为
String line = null;
while (((line = in.readLine())!= null)) {
    out.print(line);
}比如我只要读取文件的部分行,从第11-99行,应该怎么写??

解决方案 »

  1.   

    String line = null;
    int iBegin = 11, iEnd = 99;
    int iLine = 1;
    while (((line = in.readLine())!= null)) {
        if (iLine>=iBegin && iLine<=iEnd){
          out.print(line);
        }
        iLine++;
    }
      

  2.   

    没有相关函数,只能不断调用readLine()来控制.
      

  3.   

    BufferedReader can not reading by specified line number! it reads file from begin to end , you can use RandomAccessFile
      

  4.   

    能不能和SQL里分页一样来读TOP10条记录啊