or null if level is 0 (store-only mode).
lz4CompressBlockWithDict
private fn
ubyte[] lz4CompressBlockWithDict(const(ubyte)[] src, int level, const(ubyte)[] dict)Compress a single block of data using the LZ4 block format with dictionary.
This is the dictionary-aware version of lz4CompressBlock. When a dictionary is provided, it enables matches to reference data in the dictionary, improving compression for data similar to the dictionary.
The compression level controls both the hash table size and the matching strategy:
- Level 0: Store-only mode. Returns
nullto signal uncompressed block. - Levels 1-6: Greedy matching with dictionary support.
- Levels 7-9: HC (lazy) matching with dictionary support.
Parameters
src | Input bytes to compress. |
level | Compression level (0-9). Default is 1 for fast compression. |
dict | Optional dictionary data (may be null or empty). |
Returns
Newly allocated array containing the LZ4-compressed block,
Throws
CompressionError with ErrorCode.INVALID_INPUT if
src.length exceeds LZ4_MAX_INPUT_SIZE.