6516099: InputStream.skipFully(int k) to skip exactly k bytes

Brian Burkhalter brian.burkhalter at oracle.com
Tue Oct 23 18:29:19 UTC 2018


Hi Brent,

That is exactly why version .00 of the patch implemented skipNBytes() in a fixed way in terms of read(). I think that there is a good compromise however and I shall update the patch accordingly.

Thanks,

Brian

> On Oct 22, 2018, at 12:55 PM, Brent Christian <brent.christian at oracle.com> wrote:
> 
> 562     public void skipNBytes(long n) throws IOException {
> 563         if (n > 0 && skip(n) != n) {
> 564             throw new EOFException("End of stream before enough bytes skipped");
> 565         }
> 566     }
> 
> If an overrided skip() method were to skip < n bytes but not yet be at EOF, which I think the skip() spec allows, then wouldn't skipNBytes() throw an EOFException ?



More information about the core-libs-dev mailing list