6516099: InputStream.skipFully(int k) to skip exactly k bytes
Brian Burkhalter
brian.burkhalter at oracle.com
Wed Nov 7 23:37:55 UTC 2018
Hi Daniel,
> On Nov 7, 2018, at 3:49 AM, Daniel Fuchs <daniel.fuchs at oracle.com> wrote:
>
> I am not sure whether you can trust that a skip implementation
> that returns -1 has actually rewind 1 byte - for instance:
>
> http://hg.openjdk.java.net/jdk/jdk/file/44f34d2c3243/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java#l99 <http://hg.openjdk.java.net/jdk/jdk/file/44f34d2c3243/src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java#l99>
The above class is not a descendent of InputStream. In any case, as InputStream and all its “direct known subclasses” specify that skip() returns “the actual number of bytes skipped” the foregoing behavior would I think be a bug.
> Not sure there's anything that could be done in such cases, except
> encouraging such subclasses to provide their own implementation
> of skipNBytes?
That’s probably true.
Thanks,
Brian
More information about the core-libs-dev
mailing list