Closed bthulu closed 3 years ago
It is based on lz4's LZ4_COMPRESSZBOUND()
https://github.com/lz4/lz4/blob/d44371841a2f1728a3f36839fd4b7e872d0927d3/lib/lz4.h#L171. In the worst case where the input is not compressible, the compressed length can be larger than the input length.
it's so strange that the maxCompressedLength is always big than source length, is this wrong? net.jpountz.lz4.LZ4Utils#maxCompressedLength
static int maxCompressedLength(int length) { if (length < 0) { throw new IllegalArgumentException("length must be >= 0, got " + length); } else if (length >= MAX_INPUT_SIZE) { throw new IllegalArgumentException("length must be < " + MAX_INPUT_SIZE); } return length + length / 255 + 16; }