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

Roger Riggs Roger.Riggs at oracle.com
Fri Nov 16 19:23:32 UTC 2018


Looks great!

Thanks, Roger


On 11/16/2018 02:14 PM, Brian Burkhalter wrote:
> Hi Roger,
>
> Thanks for the suggestions. Version 7
>
> http://cr.openjdk.java.net/~bpb/6516099/webrev.07/ 
> <http://cr.openjdk.java.net/%7Ebpb/6516099/webrev.07/>
>
> is updated in place with this diff:
>
> --- a/src/java.base/share/classes/java/io/InputStream.java
> +++ b/src/java.base/share/classes/java/io/InputStream.java
> @@ -579,6 +579,7 @@
>     *             when this method was invoked.
>     * @throws     IOException  if the stream cannot be positioned 
> properly or
>     *             if an I/O error occurs.
> +     * @see        java.io.InputStream#skip(long)
>     */
>   public void skipNBytes(long n) throws IOException {
>       if (n > 0) {
> @@ -595,7 +596,7 @@
>                   throw new EOFException();
>               }
>           } else if (ns != n) { // skipped negative or too many bytes
> -               throw new IOException();
> +               throw new IOException("Unable to skip exactly");
>           }
>       }
>   }
>
> Thanks,
>
> Brian
>
>> On Nov 15, 2018, at 8:23 AM, Roger Riggs <Roger.Riggs at Oracle.com 
>> <mailto:Roger.Riggs at Oracle.com>> wrote:
>>
>> Looking good.
>>
>> I would add a message to the thrown IOException @598:  "Unable to 
>> skip exactly".
>>
>> Adding a @see to skip(n) would be a good addition to recommend using 
>> skipNBytes.
>



More information about the core-libs-dev mailing list