SeekableByteChannel not seekable?
Simone Bordet
simone.bordet at gmail.com
Wed Jul 31 09:40:15 UTC 2019
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.
Maybe just needs explicit documentation?
I am an OpenJDK author and can file a bug if necessary.
Thanks!
2019-07-30 20:20:52.188:WARN:oejs.HttpChannel:qtp1717159510-47: /zipfs/large.dat
java.lang.UnsupportedOperationException
at com.sun.nio.zipfs.ZipFileSystem$3.position(ZipFileSystem.java:653)
at org.eclipse.jetty.util.resource.PathResource.writeTo(PathResource.java:591)
at org.eclipse.jetty.server.ResourceService.sendData(ResourceService.java:755)
at org.eclipse.jetty.server.ResourceService.doGet(ResourceService.java:294)
at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:454)
--
Simone Bordet
---
Finally, no matter how good the architecture and design are,
to deliver bug-free software with optimal performance and reliability,
the implementation technique must be flawless. Victoria Livschitz
More information about the nio-dev
mailing list