JDK 9 RFR of JDK-8136738: InputStream documentation for IOException in skip() is unclear or incorrect
Pavel Rappo
pavel.rappo at oracle.com
Fri Jun 3 18:34:45 UTC 2016
> On 3 Jun 2016, at 19:30, Bernd Eckenfels <ecki at zusammenkunft.net> wrote:
>
> It is unclear to me if this is really forbidden in the interface or in
> any implementation. With FileInputStream skip(-5) works.
Don't mistake `seek` for `skip`. `skip` can be implemented using `read`, but
may be using `seek`.
Here's the API point of view:
* If {@code n} is
* negative, the {@code skip} method for class {@code InputStream} always
* returns 0, and no bytes are skipped. Subclasses may handle the negative
* value differently.
Thanks,
-Pavel
More information about the core-libs-dev
mailing list