Compressed stream is not valid


I compressed file using lz4.exe and compare it with file created using LZ4Stream and it does not give valid compression stream!

Differences can be checked by binary comparing files (I compare file from other issue)

file attachments

Closed May 29, 2013 at 12:04 PM by Krashan


Krashan wrote May 29, 2013 at 12:02 PM

LZ4Stream is NOT the same stream as produced by lz4 C library. It is not compatible, and it was never meant to be. I just adapted BlockCompressionStream which I wrong long time ago handling any block compression.

Currently, I'm not planning to implement compatible lz4 stream.

Krashan wrote May 29, 2013 at 2:50 PM

Let clear some confusion.

A buffer compressed with original LZ4 is compatible with buffer compressed with LZ4.NET (you can compress with one and decompress with the other one). They might not be identical (depending on configuration , for example dictionary size, and release) but they ARE compatible.

LZ4 command line tool uses LZ4HC by default, while LZ4Stream uses LZ4 (not HC).

LZ4Stream is just a wrapper around block compression and it adds some kind of header before every block. This header has different format than header added by original LZ4 stream proposed by Yann.
The reason is I wrote this stream encapsulation long time ago for any block compression and just adapted it for LZ4.