lz4 / lz4-java

LZ4 compression for Java
Apache License 2.0
1.1k stars 253 forks source link

[Feature request] Add methods compressWithLength and decompressWithLength #119

Closed jiming closed 6 years ago

jiming commented 6 years ago

Hi,

It is really inconvenient when decompress data now.

Something we just need the data to be compressed and decompressed later, we do not really care the data is standard or could be decompressed by other application.

I think add a mothed compressWithLength to return the compressed data in byte[] and add four byte as Integer to store the length of original data. Which cause the result 4 bytes longer. But it worth it as it makes code more clean and easy.

Thanks!

odaira commented 6 years ago

I have test-implemented LZ4CompressorWithLength and LZ4DecompressorWithLength in 7a162150b33f65e6b7e2390b2f38d8118e9cbe3e. Any comments are welcome.

jiming commented 6 years ago

@odaira

Very nice! That's what I expected! Thanks!

Jiming