BufferedInputReader

Archie Cobbs archie at whistle.com
Tue Dec 21 10:29:49 PST 1999


Kero van Gelder writes:
> I encountered a small problem using the BufferedInputStream.
> When telling it to skip a big number of bytes, it stops at the first
> 2k boundary (or, more precisely, from position 32 to skip 37919 bytes
> lets it stop at position 2048).
> 
> Removing the BufferedInputStream and using only the
> ByteArrayInputStream that is underneath works.
> 
> The funny thing is that sun/blackdown:
> $ java -version
> java version "1.2"
> Classic VM (build Linux_JDK_1.2_pre-release-v2, native threads, sunwjit)
> 
> has _exactly_ the same problem, where _exactly_ the same solution worked.
> I don't want to be rude, but who is stealing code from whom?

This is not a bug.  The skip() method as defined in FilterInputStream
is not required to skip the number of bytes requested.

Ref: http://java.sun.com/products/jdk/1.2/docs/api/java/io/BufferedInputStream.html#skip(long)

No code was stolen :-) Kaffe tries to behave like JDK whenever possible
and in this case is just using the same default buffer size (eg., 2048).

Presumably, JDK and kaffe use the same (obvious) skip() algorithm,
i.e., skip remaining buffered data first.

-Archie

___________________________________________________________________________
Archie Cobbs   *   Whistle Communications, Inc.  *   http://www.whistle.com


More information about the kaffe mailing list