lz4/lz4-java

how can i know destLen By compressed value?

hisenyuan opened this issue · 2 comments

LZ4FastDecompressor decompressor = factory.fastDecompressor();
byte[] restored = new byte[decompressedLength];
int compressedLength2 = decompressor.decompress(compressed, 0, restored, 0, decompressedLength);

if i dont know dest value how i can get the length?

There is no way to get the decompressed length. You must store it at somewhere when you compress the data, or you can use LZ4SafeDecompressor, or you may want to use LZ4CompressorWithLength/LZ4DecompressorWithLength.

There is no way to get the decompressed length. You must store it at somewhere when you compress the data, or you can use LZ4SafeDecompressor, or you may want to use LZ4CompressorWithLength/LZ4DecompressorWithLength.

LZ4SafeDecompressor also need decompressed length.
LZ4CompressorWithLength/LZ4DecompressorWithLength need srcValue.

Zstd provider a method to get decompressedLength by compressedValue.
Zstd.decompressedSize(compressedValue);

i think lz4 maybe have the same method,but ...

btw,thanks!