The ZLibEncoder encoder is used by ZLibCodec and GZipCodec to compress data.

Inheritance

Properties

dictionary List<int>
read-only

Initial compression dictionary.

gzip bool
read-only

When true, GZip frames will be added to the compressed data.

level int
read-only

The compression-level can be set in the range of -1..9, with 6 being the default compression level. Levels above 6 will have higher compression rates at the cost of more CPU and memory usage. Levels below 6 will use less CPU and memory at the cost of lower compression rates.

memLevel int
read-only

Specifies how much memory should be allocated for the internal compression state. 1 uses minimum memory but is slow and reduces compression ratio; 9 uses maximum memory for optimal speed. The default value is 8.

raw bool
read-only

When true, deflate generates raw data with no zlib header or trailer, and will not compute an adler32 check value

strategy int
read-only

Tunes the compression algorithm. Use the value ZLibOption.STRATEGY_DEFAULT for normal data, ZLibOption.STRATEGY_FILTERED for data produced by a filter (or predictor), ZLibOption.STRATEGY_HUFFMAN_ONLY to force Huffman encoding only (no string match), or ZLibOption.STRATEGY_RLE to limit match distances to one (run-length encoding).

windowBits int
read-only

Base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15. Larger values result in better compression at the expense of memory usage. The default value is 15

Constructors

ZLibEncoder({bool gzip: false, int level: ZLibOption.DEFAULT_LEVEL, int windowBits: ZLibOption.DEFAULT_WINDOW_BITS, int memLevel: ZLibOption.DEFAULT_MEM_LEVEL, int strategy: ZLibOption.STRATEGY_DEFAULT, List<int> dictionary: null, bool raw: false})

Methods

bind(Stream source) → Stream
inherited

Transform the incoming stream's events.

convert(List<int> bytes) → List<int>

Convert a list of bytes using the options given to the ZLibEncoder constructor.

fuse(Converter<List<int>> other) → Converter<List<int>>
inherited

Fuses this with other.

startChunkedConversion(Sink<List<int>> sink) → ByteConversionSink

Start a chunked conversion using the options given to the ZLibEncoder constructor. While it accepts any Sink taking List's, the optimal sink to be passed as sink is a ByteConversionSink.