BufferedInputReader

Kero van Gelder kero at p2939.nl.wish.net
Tue Dec 21 15:43:28 PST 1999


> > 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).
> 
> 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)

Forgive my ignorance!

I guess there is no use in complaining about such a useless API in
this newsgroup, is there? Sorry, but I could not possibly imagine that
this was _not_ a bug... Not that ``for a variety of reasons'' is a
clear way of telling when skip(n) might not skip n bytes.

(if anybody knows an alternative call that I can use, mail me :-)

I guess I'll ByteArray my files instead of Buffering them. Fast enough
and no problems with 2k boundaries. Lucky for me my files are only
several 100k 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).

Fine with me. Sorry if I appeared harsh.
(But it is something to be wary about.)

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

Apparently...

It's good to test programs on >1 JVM, preferably 1.1 and 1.2
mixed.

Merry Christmas everybody!
Kero.

+--- Kero ---------------------------------- kero at dds.nl ---+
| If there were no hell to pay, would you still need a God? |
|                             -- Leah Androne               |
+--- M38C --------------- http://www.huizen.dds.nl/~kero ---+


More information about the kaffe mailing list