Class Gz.deflate
- Description
This class interfaces with the compression routines in the libz library.
- Note
This class is only available if libz was available and found when Pike was compiled.
- See also
- Method create
Gz.deflate Gz.deflate(
int(-9..9)
|void
level
,int
|void
strategy
,int(8..15)
|void
window_size
)
Gz.deflate Gz.deflate(
mapping
options
)- Description
This function can also be used to re-initialize a Gz.deflate object so it can be re-used.
If a mapping is passed as the only argument, it will accept the parameters described below as indices, and additionally it accepts a
string
asdictionary
.- Parameter
level
Indicates the level of effort spent to make the data compress well. Zero means no packing, 2-3 is considered 'fast', 6 is default and higher is considered 'slow' but gives better packing.
If the argument is negative, no headers will be emitted. This is needed to produce ZIP-files, as an example. The negative value is then negated, and handled as a positive value.
- Parameter
strategy
The strategy to be used when compressing the data. One of the following.
DEFAULT_STRATEGY
The default strategy as selected in the zlib library.
FILTERED
This strategy is intented for data created by a filter or predictor and will put more emphasis on huffman encoding and less on LZ string matching. This is between DEFAULT_STRATEGY and HUFFMAN_ONLY.
RLE
This strategy is even closer to the HUFFMAN_ONLY in that it only looks at the latest byte in the window, i.e. a window size of 1 byte is sufficient for decompression. This mode is not available in all zlib versions.
HUFFMAN_ONLY
This strategy will turn of string matching completely, only doing huffman encoding. Window size doesn't matter in this mode and the data can be decompressed with a zero size window.
FIXED
In this mode dynamic huffman codes are disabled, allowing for a simpler decoder for special applications. This mode is not available in all zlib versions.
- Parameter
window_size
Defines the size of the LZ77 window from 256 bytes to 32768 bytes, expressed as 2^x.