try{
RandomAccessFile file=new RandomAccessFile("e:/test.txt","r");
string line="";
while(line!=null)
{
line=file.readLine();
out.println(line);
out.println("<BR>");

解决方案 »

  1.   

     clane(clane) 
    你这样该的话,如果文件中间有一段空白,程序就不读后面的文字了,例如
    For information on deployment licenses, see our sales page. You may use Resin for development, evaluation, and demos. 
    后面的一句程序就不读了
      

  2.   

    try{
        RandomAccessFile file=new RandomAccessFile("e:/test.txt","r");
        String line=file.readLine();
        while(line!=null)
        {
            out.println(line);
            out.println("<BR>");
        }
    }
      

  3.   

    while(true)
    {
    String line=file.readLine();
    if (line == null) break;
    out.println(line);
    out.println("<BR>");}
    or:String line = "";
    while(line != null)
    {
    line=file.readLine();
    out.println(line);
    out.println("<BR>");}
      

  4.   

    对不起,clane,你是对的,谢谢了
      

  5.   

    try

         fff =new RandomAccessFile("e:/test.txt","r");
      filesize = fff.length();
      System.out.println("File size :"+ filesize);
      while ( filesize > filepointer)
      {
         filepointer = fff.getFilePointer();
         sss = fff.readLine();
         System.out.println("filepointer : "+filepointer+"  "+sss);
      
      }
      fff.close(); 
        }
      

  6.   

    不好意思,更正:
    同意kellychen(陈慧琳)
      

  7.   

    不会读不出来的,line=""和line=null还是有差别的。。
    另外你也可以用getFilePointer来判断