8227080: (fs) Files.newInputStream(...).skip(n) is slow

Brian Burkhalter brian.burkhalter at oracle.com
Tue Jul 2 23:16:07 UTC 2019


> On Jul 2, 2019, at 3:32 PM, Simone Bordet <simone.bordet at gmail.com> wrote:
> 
> On Wed, Jul 3, 2019 at 12:00 AM Brian Burkhalter
> <brian.burkhalter at oracle.com <mailto:brian.burkhalter at oracle.com>> wrote:
>> Here is an updated version which should not have a problem with overflow:
>> 
>> http://cr.openjdk.java.net/~bpb/8227080/webrev.01/ <http://cr.openjdk.java.net/~bpb/8227080/webrev.01/>
> 
> Why:
> 
> return sbc.position() - pos;
> 
> rather than just:
> 
> return n;

That’s what I had first before re-posting.

> Unless SeekableByteChannel.position(int) may not actually set the
> position to the given value, which I can't quite believe (as the
> javadoc says it is permitted to set it to a larger value than the
> current size)?

No, I think either way is good.

> Will you tackle the missing synchronization in another webrev?

Yes as I am sure there will be other comments from others.

Thanks,

Brian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190702/ba8715b6/attachment-0001.html>


More information about the nio-dev mailing list