On Fri, 20 Nov 2020 11:43:11 GMT, sergus13 
<github.com+74766043+sergu...@openjdk.org> wrote:

>> Brian Burkhalter has updated the pull request incrementally with two 
>> additional commits since the last revision:
>> 
>>  - 8246739: InputStream.skipNBytes could be implemented more efficiently
>>  - 8246739: InputStream.skipNBytes could be implemented more efficiently
>
> src/java.base/share/classes/java/io/InputStream.java line 605:
> 
>> 603:             } else if (ns == 0) { // no bytes skipped
>> 604:                 // read one byte to check for EOS
>> 605:                 if (read() < 0) {
> 
> Wouldn't it be better to compare return value with -1 (as it was before)?
> Since the documentation of read method says:
> _Returns:
>     the next byte of data, or **-1 if the end of the stream is reached**._

Indeed that would match the letter of the specification of `read()` but I don't 
think it would make any practical difference.

-------------

PR: https://git.openjdk.java.net/jdk/pull/1329

Reply via email to