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

Brian Burkhalter brian.burkhalter at oracle.com
Thu Nov 1 22:24:52 UTC 2018

Let’s try this again:

http://cr.openjdk.java.net/~bpb/6516099/webrev.04/ <http://cr.openjdk.java.net/~bpb/6516099/webrev.04/>

The method skipNBytes(long) is now defined in terms of the skip(n) and read(n) with the behavior for negative n being left open for subclasses.



> On Oct 25, 2018, at 7:15 AM, Roger Riggs <Roger.Riggs at Oracle.com> wrote:
> The FIS skipping past of end of file is puzzling.
> If the  'were beyond EOF' was considering the possibility that the file was being
> extended concurrently with the skip operation then it would not be random,
> just a normal writer/reader race.  The return value from skip would be accurate
> and still usable for skipNBytes.
> If the spec for skipNBytes describes its behavior in terms of the normal behaviors
> of skip(n) and read(n) then it will not making promises it can't keep regardless of the subclass behavior.
> FIS also says it can do negative seeks which seems in conflict with InputStream.
> The FIS.skip(-n) behavior raises the question about whether InputStream.skipNBytes should
> allow -n?

More information about the core-libs-dev mailing list