luben / zstd-jni

JNI binding for Zstd
Other
854 stars 168 forks source link

Relax the requirement for source and target ByteBuffer in ZstdBufferDecompressingStream #252

Closed divijvaidya closed 1 year ago

divijvaidya commented 1 year ago

At https://github.com/luben/zstd-jni/blob/master/src/main/java/com/github/luben/zstd/ZstdBufferDecompressingStreamNoFinalizer.java#L47-L48 extractArray() ensures that the buffer.arrayOffset() != 0. However, that is not a strict requirement for ZstdBufferDecompressingStream since it works with the case [1] where ByteBuffer may have a non-zero position.

[1] https://github.com/luben/zstd-jni/blob/master/src/main/java/com/github/luben/zstd/BaseZstdBufferDecompressingStreamNoFinalizer.java#L71