You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
publicstaticvoidmain( String[] args ) throwsIOException
{
ByteHandlerhandler = newLZ4Compressor();
byte[] b = {4, 34, 77, 24, 96, 112, 115, 6, 0, 0, -128, 3, 0, 1, 0, 0, 0}; // Test data from one of our unit testsInputStreaminputStream = handler.deserialize(newByteArrayInputStream(b));
byte[] i = inputStream.readAllBytes();
}
I've done some debugging and it seems like its not marking the frame as finished.
privatevoidreadBlock() throwsIOException {
// Reads Ok up to this point// Reads the last 6 bytes 3, 0, 1, 0, 0, 0 intblockSize = readInt(in);
finalbooleancompressed = (blockSize & LZ4FrameOutputStream.LZ4_FRAME_INCOMPRESSIBLE_MASK) == 0;
blockSize &= ~LZ4FrameOutputStream.LZ4_FRAME_INCOMPRESSIBLE_MASK; // blocksize = 6// Check for EndMarkif (blockSize == 0) { // Since this is 6 its doesnt enter the loop
......
frameInfo.finish();
return;
}
Hence the next time it tries to read the stream which has already been completed it leaks into readBlock(); and breaks.
publicintread() throwsIOException {
while (!firstFrameHeaderRead || buffer.remaining() == 0) {
if (!firstFrameHeaderRead || frameInfo.isFinished()) {
if (firstFrameHeaderRead && readSingleFrame) {
return -1;
}
if (!nextFrameInfo()) {
return -1;
}
}
readBlock();
}
So I'm trying to switch our compressor to lz4-java from snappy and I was trying something like this for a POC
When I try a readAllBytes() on the LZ4FrameInputStream it throw the below exception an breaks.
ERROR
Calling Function
I've done some debugging and it seems like its not marking the frame as finished.
Hence the next time it tries to read the stream which has already been completed it leaks into readBlock(); and breaks.
This is our Compressor implementation
The text was updated successfully, but these errors were encountered: