tukaani-project / xz-java

XZ for Java
https://tukaani.org/xz/java.html
BSD Zero Clause License
23 stars 14 forks source link

[Feature Request]: SeekableXZInputStream ability to write straight into java.nio.ByteBuffer #2

Open xbotuk opened 1 year ago

xbotuk commented 1 year ago

Describe the Feature

Can you please add methods in SeekableXZInputStream ability to write straight into an existing java.nio.ByteBuffer

This is to replicate something like

ByteBuffer bytebuffer = ByteBuffer.allocateDirect(65536);
RandomAccessFile raf = new RandomAccessFile(filePath, "r");
FileChannel fc = raf.getChannel();
ByteBuffer.allocateDirect(this.bufferSize);

// call next statements many ties  by seeking various positions
fc.read(bytebuffer);
bytebuffer.flip();

Expected Complications

ByteBuffer is available since old versions of java, so adding this feature should not be an issue.

Will I try to implement this new feature?

No

JiaT75 commented 1 year ago

Hi! Thank you for the feature request. Unfortunately, this is the wrong repository for this since this is XZ Utils (the C version). XZ for Java has not been moved to GitHub yet, so the code repository is still located at https://git.tukaani.org/xz-java.git.

So, until we move XZ for Java to GitHub, you will need to request features or report bugs either to xz@tukaani.org or the xz-devel mailing list. Instructions for subscribing to the mailing list are documented here: https://tukaani.org/xz/lists.html. You do not need to subscribe to the mailing list to email xz@tukaani.org, but then only the maintainers will be able to see your mails.

Thanks again for the feature request!

JiaT75 commented 1 year ago

Now that the XZ for Java repository has officially moved to GitHub this issue has been moved and reopened. This isn't a promise that we will implement the feature, just that we are considering it now.

bokken commented 7 months ago

Is the ask here to implement ReadableByteChannel? https://docs.oracle.com/javase/8/docs/api/java/nio/channels/ReadableByteChannel.html

Larhzu commented 1 month ago

I still haven't really looked into this. SeekableByteChannel would be a standard interface so perhaps that could be valuable? All internal APIs use streams and I suppose it doesn't make sense to change that. So ByteChannel support would be some sort of thin wrapper.