Open mgrundie-r7 opened 1 year ago
That's because you are decompressing only one block (you should call compressedInputStream .read()
more than once).
Instead of:
byte[] decompressedData = new byte[data.length];
compressedInputStream.read(decompressedData);
Try:
byte[] decompressedData = compressedInputStream.readAllBytes();
I can't control what the callers do and the callers have no specific knowledge which type of InputStream this is. I ended up writing an adapter that extends InputStream and delegates to LZ4FrameInputStream to add some reset capability and to chunk read when read is asked to read > 4194304
The above assertion passes. If you update the code to
data = new byte[4194305];
then the assertion fails and the 4194305th element of decompressedData (decompressedData[4194304]) will equal 0