SeekableByteChannel not seekable?
Alan Bateman
Alan.Bateman at oracle.com
Wed Jul 31 12:26:47 UTC 2019
On 31/07/2019 02:40, Simone Bordet wrote:
> Hi,
>
> seems that the SeekableByteChannel returned by Files.newByteChannel()
> is not seekable if the path is from a zipfs, see exception below.
>
> We do:
>
> try (SeekableByteChannel channel = Files.newByteChannel(path,
> StandardOpenOption.READ))
> {
> channel.position(start); // BOOM
> }
>
> where path is a path from a ZipFileSystem.
>
> Is that expected behavior? Seems strange that we get a
> SeekableByteChannel that does not support seek - understandable given
> the zipfs but still weird.
Which JDK release or build is this? This part of the zipfs code was
re-implemented in JDK 12 so that it does support SeekableByteChannel and
the position methods should work correctly.
-Alan
More information about the nio-dev
mailing list