[kaffe] Problem with BufferedInputStream [patch]

Mark Wielaard mark at klomp.org
Thu Jun 5 09:43:01 PDT 2003


On Thu, 2003-06-05 at 17:54, Mark Wielaard wrote:
> On Thu, 2003-06-05 at 15:48, Helmer Krämer wrote:
> > 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?
> Seems that is more correct. But since available() isn't that reliable I
> wouldn't implement it that way since it might make the method block much
> more then needed. See for example the java.util.ZipInputStream
> available() method definition (which says to almost always returns 1!).
> Also note that the javadoc say:
>         Subclasses of this class are encouraged, but not required, to
>         attempt to read as many bytes as possible in the same fashion.
> So users cannot rely on this behaviour anyway.

But I did try it out and the attached patch does what you suggest. Makes
the simple ReadLineTest and Snark work correctly and doesn't introduce
Mauve or make check regressions.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: BufferedInputStream.patch2
Type: text/x-patch
Size: 760 bytes
Desc: not available
Url : http://kaffe.org/pipermail/kaffe/attachments/20030605/d6db917c/attachment-0002.bin 

More information about the kaffe mailing list