zlib-0.3: Compression and decompression in the gzip and zlib formatsContentsIndex
Codec.Compression.Zlib.Internal
Portabilityportable (H98 + FFI)
Stabilityexperimental
Maintainerduncan.coutts@worc.ox.ac.uk
Contents
Compression and decompression
The same but with the full set of parameters
Description
Pure stream based interface to lower level zlib wrapper
Synopsis
compressDefault :: Format -> CompressionLevel -> ByteString -> ByteString
decompressDefault :: Format -> ByteString -> ByteString
data Format
= GZip
| Zlib
| Raw
| GZipOrZlib
data CompressionLevel
= DefaultCompression
| NoCompression
| BestSpeed
| BestCompression
| CompressionLevel Int
compressFull :: Format -> CompressionLevel -> Method -> WindowBits -> MemoryLevel -> CompressionStrategy -> ByteString -> ByteString
decompressFull :: Format -> WindowBits -> ByteString -> ByteString
data Method = Deflated
data WindowBits
= DefaultWindowBits
| WindowBits Int
data MemoryLevel
= DefaultMemoryLevel
| MinMemoryLevel
| MaxMemoryLevel
| MemoryLevel Int
data CompressionStrategy
= DefaultStrategy
| Filtered
| HuffmanOnly
| RLE
| Fixed
Compression and decompression
compressDefault :: Format -> CompressionLevel -> ByteString -> ByteString
decompressDefault :: Format -> ByteString -> ByteString
data Format
Constructors
GZipEncode or decode with the gzip header format.
ZlibEncode or decode with the zlib header format.
RawEncode or decode a raw data stream without any header.
GZipOrZlibEnable zlib or gzip decoding with automatic header detection. This only makes sense for decompression.
data CompressionLevel
Control amount of compression. This is a trade-off between the amount of compression and the time and memory required to do the compression.
Constructors
DefaultCompressionThe default compression level is 6 (that is, biased towards high compression at expense of speed).
NoCompressionNo compression, just a block copy.
BestSpeedThe fastest compression method (less compression)
BestCompressionThe slowest compression method (best compression).
CompressionLevel IntA specific compression level between 1 and 9.
show/hide Instances
The same but with the full set of parameters
compressFull :: Format -> CompressionLevel -> Method -> WindowBits -> MemoryLevel -> CompressionStrategy -> ByteString -> ByteString
decompressFull :: Format -> WindowBits -> ByteString -> ByteString
data Method
The compression method
Constructors
Deflated'Deflate' is the only one supported in this version of zlib.
show/hide Instances
data WindowBits
Constructors
DefaultWindowBits
WindowBits Int
data MemoryLevel
The MemoryLevel parameter specifies how much memory should be allocated for the internal compression state.
Constructors
DefaultMemoryLevelThe default. (Equivalent to MemoryLevel 8)
MinMemoryLevelUse minimum memory. This is slow and reduces the compression ratio. (Equivalent to MemoryLevel 1)
MaxMemoryLevelUse maximum memory for optimal compression speed. (Equivalent to MemoryLevel 9)
MemoryLevel IntUse a specific level in the range 1..9
show/hide Instances
data CompressionStrategy

The strategy parameter is used to tune the compression algorithm.

The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately.

Constructors
DefaultStrategyUse the DefaultStrategy for normal data.
FilteredUse Filtered for data produced by a filter (or predictor). Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. The effect of Z_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between DefaultStrategy and HuffmanOnly.
HuffmanOnlyUse HuffmanOnly to force Huffman encoding only (no string match).
RLEUse RLE to limit match distances to one (run-length encoding). RLE is designed to be almost as fast as HuffmanOnly, but give better compression for PNG image data.
FixedFixed prevents the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.
show/hide Instances
Produced by Haddock version 0.8