Jian Zhang wrote:

                do {
                        int len = reader.read(buf, 0, 10240);
                        doc.append(new String(buf, 0, len));
                        if (len < 10240) {
                                break;
                        } else {
                                start += len;
                        }
                } while (true);
                return doc.toString();
        }
        

By the way, it is a quite a bad idea to test the end of file condition by testing whether less than the buffer size has been read. The API of the Reader class does not require that the read method completely fills the given buffer in the case that the EOF hasn't been reached. Check for len == -1 instead (before the append, of course!). And, if you are using Java >= 1.5, prefer StringBuilder to StringBuffer.

Regards,

Klaus


___________________________________________________________________________
     |       |
     | knipp |                   Knipp  Medien und Kommunikation GmbH
      -------                           Technologiepark
                                        Martin-Schmeißer-Weg 9
     Dipl. Inf. Klaus Malorny           44227 Dortmund
     [EMAIL PROTECTED]             Tel. +49 231 9703 0



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to