[kaffe] Problem with BufferedInputStream [patch]

Helmer Krämer hkraemer at freenet.de
Thu Jun 5 06:46:02 PDT 2003


On 05 Jun 2003 14:41:41 +0200
Mark Wielaard <mark at klomp.org> wrote:

Hi Mark,

> The attached patch removes the while (len > 0) construct which makes the
> above program (and The Hunting of the Snark Project) work correctly.
> 
> Mauve and make check results do not show regressions with this change.

thanks for the patch, feels good to have some active users out
there :)

Just some minor comments, though. If I understand the spec correctly,
BufferedInputStream.read() should block until data is available and
read as much of it as possible afterwards (either until the destination
buffer is full or until further reading from the underlying input
stream would block again).

IMHO, simply removing the loop would break this, since without the
loop you will only read as much data as is already buffered in the
BufferedInputStream itself, you will not take care of data that might
be available in the underlying input stream and thus could be read
without blocking.

So I would not completely remove the loop, but rather replace it with
something like "do {} while (len>0 && available()>0)"; dunno whether
that's really more correct, though...

What do you think?

Greetings,
Helmer




More information about the kaffe mailing list