classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

java.io.DataInputStream.readLine misbehaviour


From: Guilhem Lavaux
Subject: java.io.DataInputStream.readLine misbehaviour
Date: Fri, 31 Oct 2003 19:12:32 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3.1) Gecko/20030428

Hi,

Continuing the Classpath-Kaffe merge, I noticed that DataInputStream is failing one of kaffe's regression test (InputStreamTest). It seems the failure comes from readLine(): readLine() is a little too conservative compared to JDK's implementation. The real behaviour seems to be the following:

readLine() is invoked => it reads bytes until it finds a '\r' => it reads the next byte
* if it is  a '\n' it eats it
* if it isn't it keeps it in an internal buffer until someone calls another read methods.

But in any case the byte isn't put back in the input buffer. The real problem is what happens when someone calls one of the inherited method from FilterInputStream which are not overloaded (e.g. available).

Kaffe's answer was to create a mini-buffer with default access in FilterInputStream. It is obvious it is clumsy because it slightly changes the API, but the only other option would be to overload all read functions.

So what's your opinion for Classpath ?

Regards,
Guilhem.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]