Hi all. A recent issue COMPRESS-499( https://issues.apache.org/jira/projects/COMPRESS/issues/COMPRESS-499) discussed about a potential problem in SeekableInMemoryByteChannel. Based on the java docs( https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/nio/channels/SeekableByteChannel.html#truncate(long )), I believe there are some problems in the SeekableInMemoryByteChannel . The method repositionIfNecessary() may change the position of the channel, which may be a bug basing on the docs, and it's called in read and truncate. I'm not an expert on SeekableByteChannel, and I'm not sure if SeekableInMemoryByteChannel is doing this intentionally or not.
What do you think? cheers, Lee
