-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Compression and decompression in the gzip and zlib formats -- -- This package provides a pure interface for compressing and -- decompressing streams of data represented as lazy ByteStrings. -- It uses the zlib C library so it has high performance. It supports the -- "zlib", "gzip" and "raw" compression formats. -- -- It provides a convenient high level api suitable for most tasks and -- for the few cases where more control is needed it provides access to -- the full zlib feature set. @package zlib @version 0.5.0.0 -- | Pure stream based interface to lower level zlib wrapper module Codec.Compression.Zlib.Internal compress :: Format -> CompressParams -> ByteString -> ByteString -- | The full set of parameters for compression. The defaults are -- defaultCompressParams. -- -- The compressBufferSize is the size of the first output buffer -- containing the compressed data. If you know an approximate upper bound -- on the size of the compressed data then setting this parameter can -- save memory. The default compression output buffer size is -- 16k. If your extimate is wrong it does not matter too much, -- the default buffer size will be used for the remaining chunks. data CompressParams CompressParams :: CompressionLevel -> Method -> WindowBits -> MemoryLevel -> CompressionStrategy -> Int -> CompressParams compressLevel :: CompressParams -> CompressionLevel compressMethod :: CompressParams -> Method compressWindowBits :: CompressParams -> WindowBits compressMemoryLevel :: CompressParams -> MemoryLevel compressStrategy :: CompressParams -> CompressionStrategy compressBufferSize :: CompressParams -> Int -- | The default set of parameters for compression. This is typically used -- with the compressWith function with specific paramaters -- overridden. defaultCompressParams :: CompressParams decompress :: Format -> DecompressParams -> ByteString -> ByteString -- | The full set of parameters for decompression. The defaults are -- defaultDecompressParams. -- -- The decompressBufferSize is the size of the first output -- buffer, containing the uncompressed data. If you know an exact or -- approximate upper bound on the size of the decompressed data then -- setting this parameter can save memory. The default decompression -- output buffer size is 32k. If your extimate is wrong it does -- not matter too much, the default buffer size will be used for the -- remaining chunks. -- -- One particular use case for setting the decompressBufferSize is -- if you know the exact size of the decompressed data and want to -- produce a strict Data.ByteString.ByteString. The compression -- and deccompression functions use lazy -- Data.ByteString.Lazy.ByteStrings but if you set the -- decompressBufferSize correctly then you can generate a lazy -- Data.ByteString.Lazy.ByteString with exactly one chunk, which -- can be converted to a strict Data.ByteString.ByteString in -- O(1) time using Data.ByteString.concat . -- Data.ByteString.Lazy.toChunks. data DecompressParams DecompressParams :: WindowBits -> Int -> DecompressParams decompressWindowBits :: DecompressParams -> WindowBits decompressBufferSize :: DecompressParams -> Int -- | The default set of parameters for decompression. This is typically -- used with the compressWith function with specific paramaters -- overridden. defaultDecompressParams :: DecompressParams -- | The format used for compression or decompression. There are three -- variations. data Format -- | The gzip format uses a header with a checksum and some optional -- meta-data about the compressed file. It is intended primarily for -- compressing individual files but is also sometimes used for network -- protocols such as HTTP. The format is described in detail in RFC #1952 -- http://www.ietf.org/rfc/rfc1952.txt GZip :: Format Zlib :: Format -- | The zlib format uses a minimal header with a checksum but no other -- meta-data. It is especially designed for use in network protocols. The -- format is described in detail in RFC #1950 -- http://www.ietf.org/rfc/rfc1950.txt Raw :: Format -- | This is not a format as such. It enabled zlib or gzip decoding with -- automatic header detection. This only makes sense for decompression. GZipOrZlib :: Format -- | The compression level parameter controls the amount of compression. -- This is a trade-off between the amount of compression and the time -- required to do the compression. data CompressionLevel -- | The default compression level is 6 (that is, biased towards higher -- compression at expense of speed). DefaultCompression :: CompressionLevel -- | No compression, just a block copy. NoCompression :: CompressionLevel -- | The fastest compression method (less compression) BestSpeed :: CompressionLevel -- | The slowest compression method (best compression). BestCompression :: CompressionLevel -- | A specific compression level between 1 and 9. CompressionLevel :: Int -> CompressionLevel -- | The compression method data Method -- | 'Deflate' is the only method supported in this version of zlib. Indeed -- it is likely to be the only method that ever will be supported. Deflated :: Method -- | This specifies the size of the compression window. Larger values of -- this parameter result in better compression at the expense of higher -- memory usage. -- -- The compression window size is the value of the the window bits raised -- to the power 2. The window bits must be in the range 8..15 -- which corresponds to compression window sizes of 256b to 32Kb. The -- default is 15 which is also the maximum size. -- -- The total amount of memory used depends on the window bits and the -- MemoryLevel. See the MemoryLevel for the details. data WindowBits DefaultWindowBits :: WindowBits WindowBits :: Int -> WindowBits -- | The MemoryLevel parameter specifies how much memory should be -- allocated for the internal compression state. It is a tradoff between -- memory usage, compression ratio and compression speed. Using more -- memory allows faster compression and a better compression ratio. -- -- The total amount of memory used for compression depends on the -- WindowBits and the MemoryLevel. For decompression it -- depends only on the WindowBits. The totals are given by the -- functions: -- --
-- compressTotal windowBits memLevel = 4 * 2^windowBits + 512 * 2^memLevel -- decompressTotal windowBits = 2^windowBits ---- -- For example, for compression with the default windowBits = 15 -- and memLevel = 8 uses 256Kb. So for example a -- network server with 100 concurrent compressed streams would use -- 25Mb. The memory per stream can be halved (at the cost of -- somewhat degraded and slower compressionby) by reducing the -- windowBits and memLevel by one. -- -- Decompression takes less memory, the default windowBits = 15 -- corresponds to just 32Kb. data MemoryLevel -- | The default. (Equivalent to MemoryLevel 8) DefaultMemoryLevel :: MemoryLevel -- | Use minimum memory. This is slow and reduces the compression ratio. -- (Equivalent to MemoryLevel 1) MinMemoryLevel :: MemoryLevel -- | Use maximum memory for optimal compression speed. (Equivalent to -- MemoryLevel 9) MaxMemoryLevel :: MemoryLevel -- | Use a specific level in the range 1..9 MemoryLevel :: Int -> MemoryLevel -- | 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. data CompressionStrategy -- | Use the DefaultStrategy for normal data. DefaultStrategy :: CompressionStrategy -- | Use 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. Filtered :: CompressionStrategy -- | Use HuffmanOnly to force Huffman encoding only (no string -- match). HuffmanOnly :: CompressionStrategy -- | Compression and decompression of data streams in the raw deflate -- format. -- -- The format is described in detail in RFC #1951: -- http://www.ietf.org/rfc/rfc1951.txt -- -- See also the zlib home page: http://zlib.net/ module Codec.Compression.Zlib.Raw compress :: ByteString -> ByteString decompress :: ByteString -> ByteString compressWith :: CompressParams -> ByteString -> ByteString decompressWith :: DecompressParams -> ByteString -> ByteString -- | The full set of parameters for compression. The defaults are -- defaultCompressParams. -- -- The compressBufferSize is the size of the first output buffer -- containing the compressed data. If you know an approximate upper bound -- on the size of the compressed data then setting this parameter can -- save memory. The default compression output buffer size is -- 16k. If your extimate is wrong it does not matter too much, -- the default buffer size will be used for the remaining chunks. data CompressParams CompressParams :: CompressionLevel -> Method -> WindowBits -> MemoryLevel -> CompressionStrategy -> Int -> CompressParams compressLevel :: CompressParams -> CompressionLevel compressMethod :: CompressParams -> Method compressWindowBits :: CompressParams -> WindowBits compressMemoryLevel :: CompressParams -> MemoryLevel compressStrategy :: CompressParams -> CompressionStrategy compressBufferSize :: CompressParams -> Int -- | The default set of parameters for compression. This is typically used -- with the compressWith function with specific paramaters -- overridden. defaultCompressParams :: CompressParams -- | The full set of parameters for decompression. The defaults are -- defaultDecompressParams. -- -- The decompressBufferSize is the size of the first output -- buffer, containing the uncompressed data. If you know an exact or -- approximate upper bound on the size of the decompressed data then -- setting this parameter can save memory. The default decompression -- output buffer size is 32k. If your extimate is wrong it does -- not matter too much, the default buffer size will be used for the -- remaining chunks. -- -- One particular use case for setting the decompressBufferSize is -- if you know the exact size of the decompressed data and want to -- produce a strict Data.ByteString.ByteString. The compression -- and deccompression functions use lazy -- Data.ByteString.Lazy.ByteStrings but if you set the -- decompressBufferSize correctly then you can generate a lazy -- Data.ByteString.Lazy.ByteString with exactly one chunk, which -- can be converted to a strict Data.ByteString.ByteString in -- O(1) time using Data.ByteString.concat . -- Data.ByteString.Lazy.toChunks. data DecompressParams DecompressParams :: WindowBits -> Int -> DecompressParams decompressWindowBits :: DecompressParams -> WindowBits decompressBufferSize :: DecompressParams -> Int -- | The default set of parameters for decompression. This is typically -- used with the compressWith function with specific paramaters -- overridden. defaultDecompressParams :: DecompressParams -- | The compression level parameter controls the amount of compression. -- This is a trade-off between the amount of compression and the time -- required to do the compression. data CompressionLevel -- | The default compression level is 6 (that is, biased towards higher -- compression at expense of speed). DefaultCompression :: CompressionLevel -- | No compression, just a block copy. NoCompression :: CompressionLevel -- | The fastest compression method (less compression) BestSpeed :: CompressionLevel -- | The slowest compression method (best compression). BestCompression :: CompressionLevel -- | A specific compression level between 1 and 9. CompressionLevel :: Int -> CompressionLevel -- | The compression method data Method -- | 'Deflate' is the only method supported in this version of zlib. Indeed -- it is likely to be the only method that ever will be supported. Deflated :: Method -- | This specifies the size of the compression window. Larger values of -- this parameter result in better compression at the expense of higher -- memory usage. -- -- The compression window size is the value of the the window bits raised -- to the power 2. The window bits must be in the range 8..15 -- which corresponds to compression window sizes of 256b to 32Kb. The -- default is 15 which is also the maximum size. -- -- The total amount of memory used depends on the window bits and the -- MemoryLevel. See the MemoryLevel for the details. data WindowBits DefaultWindowBits :: WindowBits WindowBits :: Int -> WindowBits -- | The MemoryLevel parameter specifies how much memory should be -- allocated for the internal compression state. It is a tradoff between -- memory usage, compression ratio and compression speed. Using more -- memory allows faster compression and a better compression ratio. -- -- The total amount of memory used for compression depends on the -- WindowBits and the MemoryLevel. For decompression it -- depends only on the WindowBits. The totals are given by the -- functions: -- --
-- compressTotal windowBits memLevel = 4 * 2^windowBits + 512 * 2^memLevel -- decompressTotal windowBits = 2^windowBits ---- -- For example, for compression with the default windowBits = 15 -- and memLevel = 8 uses 256Kb. So for example a -- network server with 100 concurrent compressed streams would use -- 25Mb. The memory per stream can be halved (at the cost of -- somewhat degraded and slower compressionby) by reducing the -- windowBits and memLevel by one. -- -- Decompression takes less memory, the default windowBits = 15 -- corresponds to just 32Kb. data MemoryLevel -- | The default. (Equivalent to MemoryLevel 8) DefaultMemoryLevel :: MemoryLevel -- | Use minimum memory. This is slow and reduces the compression ratio. -- (Equivalent to MemoryLevel 1) MinMemoryLevel :: MemoryLevel -- | Use maximum memory for optimal compression speed. (Equivalent to -- MemoryLevel 9) MaxMemoryLevel :: MemoryLevel -- | Use a specific level in the range 1..9 MemoryLevel :: Int -> MemoryLevel -- | 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. data CompressionStrategy -- | Use the DefaultStrategy for normal data. DefaultStrategy :: CompressionStrategy -- | Use 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. Filtered :: CompressionStrategy -- | Use HuffmanOnly to force Huffman encoding only (no string -- match). HuffmanOnly :: CompressionStrategy -- | Compression and decompression of data streams in the zlib format. -- -- The format is described in detail in RFC #1950: -- http://www.ietf.org/rfc/rfc1950.txt -- -- See also the zlib home page: http://zlib.net/ module Codec.Compression.Zlib -- | Compress a stream of data into the zlib format. -- -- This uses the default compression parameters. In partiular it uses the -- default compression level which favours a higher compression ratio -- over compression speed, though it does not use the maximum compression -- level. -- -- Use compressWith to adjust the compression level or other -- compression parameters. compress :: ByteString -> ByteString -- | Decompress a stream of data in the zlib format. -- -- There are a number of errors that can occur. In each case an exception -- will be thrown. The possible error conditions are: -- --
-- compressWith defaultCompressParams { ... }
--
--
-- In particular you can set the compression level:
--
--
-- compressWith defaultCompressParams { compressLevel = BestCompression }
--
compressWith :: CompressParams -> ByteString -> ByteString
-- | Like decompress but with the ability to specify various
-- decompression parameters. Typical usage:
--
--
-- decompressWith defaultCompressParams { ... }
--
decompressWith :: DecompressParams -> ByteString -> ByteString
-- | The full set of parameters for compression. The defaults are
-- defaultCompressParams.
--
-- The compressBufferSize is the size of the first output buffer
-- containing the compressed data. If you know an approximate upper bound
-- on the size of the compressed data then setting this parameter can
-- save memory. The default compression output buffer size is
-- 16k. If your extimate is wrong it does not matter too much,
-- the default buffer size will be used for the remaining chunks.
data CompressParams
CompressParams :: CompressionLevel -> Method -> WindowBits -> MemoryLevel -> CompressionStrategy -> Int -> CompressParams
compressLevel :: CompressParams -> CompressionLevel
compressMethod :: CompressParams -> Method
compressWindowBits :: CompressParams -> WindowBits
compressMemoryLevel :: CompressParams -> MemoryLevel
compressStrategy :: CompressParams -> CompressionStrategy
compressBufferSize :: CompressParams -> Int
-- | The default set of parameters for compression. This is typically used
-- with the compressWith function with specific paramaters
-- overridden.
defaultCompressParams :: CompressParams
-- | The full set of parameters for decompression. The defaults are
-- defaultDecompressParams.
--
-- The decompressBufferSize is the size of the first output
-- buffer, containing the uncompressed data. If you know an exact or
-- approximate upper bound on the size of the decompressed data then
-- setting this parameter can save memory. The default decompression
-- output buffer size is 32k. If your extimate is wrong it does
-- not matter too much, the default buffer size will be used for the
-- remaining chunks.
--
-- One particular use case for setting the decompressBufferSize is
-- if you know the exact size of the decompressed data and want to
-- produce a strict Data.ByteString.ByteString. The compression
-- and deccompression functions use lazy
-- Data.ByteString.Lazy.ByteStrings but if you set the
-- decompressBufferSize correctly then you can generate a lazy
-- Data.ByteString.Lazy.ByteString with exactly one chunk, which
-- can be converted to a strict Data.ByteString.ByteString in
-- O(1) time using Data.ByteString.concat .
-- Data.ByteString.Lazy.toChunks.
data DecompressParams
DecompressParams :: WindowBits -> Int -> DecompressParams
decompressWindowBits :: DecompressParams -> WindowBits
decompressBufferSize :: DecompressParams -> Int
-- | The default set of parameters for decompression. This is typically
-- used with the compressWith function with specific paramaters
-- overridden.
defaultDecompressParams :: DecompressParams
-- | The compression level parameter controls the amount of compression.
-- This is a trade-off between the amount of compression and the time
-- required to do the compression.
data CompressionLevel
-- | The default compression level is 6 (that is, biased towards higher
-- compression at expense of speed).
DefaultCompression :: CompressionLevel
-- | No compression, just a block copy.
NoCompression :: CompressionLevel
-- | The fastest compression method (less compression)
BestSpeed :: CompressionLevel
-- | The slowest compression method (best compression).
BestCompression :: CompressionLevel
-- | A specific compression level between 1 and 9.
CompressionLevel :: Int -> CompressionLevel
-- | The compression method
data Method
-- | 'Deflate' is the only method supported in this version of zlib. Indeed
-- it is likely to be the only method that ever will be supported.
Deflated :: Method
-- | This specifies the size of the compression window. Larger values of
-- this parameter result in better compression at the expense of higher
-- memory usage.
--
-- The compression window size is the value of the the window bits raised
-- to the power 2. The window bits must be in the range 8..15
-- which corresponds to compression window sizes of 256b to 32Kb. The
-- default is 15 which is also the maximum size.
--
-- The total amount of memory used depends on the window bits and the
-- MemoryLevel. See the MemoryLevel for the details.
data WindowBits
DefaultWindowBits :: WindowBits
WindowBits :: Int -> WindowBits
-- | The MemoryLevel parameter specifies how much memory should be
-- allocated for the internal compression state. It is a tradoff between
-- memory usage, compression ratio and compression speed. Using more
-- memory allows faster compression and a better compression ratio.
--
-- The total amount of memory used for compression depends on the
-- WindowBits and the MemoryLevel. For decompression it
-- depends only on the WindowBits. The totals are given by the
-- functions:
--
-- -- compressTotal windowBits memLevel = 4 * 2^windowBits + 512 * 2^memLevel -- decompressTotal windowBits = 2^windowBits ---- -- For example, for compression with the default windowBits = 15 -- and memLevel = 8 uses 256Kb. So for example a -- network server with 100 concurrent compressed streams would use -- 25Mb. The memory per stream can be halved (at the cost of -- somewhat degraded and slower compressionby) by reducing the -- windowBits and memLevel by one. -- -- Decompression takes less memory, the default windowBits = 15 -- corresponds to just 32Kb. data MemoryLevel -- | The default. (Equivalent to MemoryLevel 8) DefaultMemoryLevel :: MemoryLevel -- | Use minimum memory. This is slow and reduces the compression ratio. -- (Equivalent to MemoryLevel 1) MinMemoryLevel :: MemoryLevel -- | Use maximum memory for optimal compression speed. (Equivalent to -- MemoryLevel 9) MaxMemoryLevel :: MemoryLevel -- | Use a specific level in the range 1..9 MemoryLevel :: Int -> MemoryLevel -- | 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. data CompressionStrategy -- | Use the DefaultStrategy for normal data. DefaultStrategy :: CompressionStrategy -- | Use 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. Filtered :: CompressionStrategy -- | Use HuffmanOnly to force Huffman encoding only (no string -- match). HuffmanOnly :: CompressionStrategy -- | Compression and decompression of data streams in the gzip format. -- -- The format is described in detail in RFC #1952: -- http://www.ietf.org/rfc/rfc1952.txt -- -- See also the zlib home page: http://zlib.net/ module Codec.Compression.GZip -- | Compress a stream of data into the gzip format. -- -- This uses the default compression parameters. In partiular it uses the -- default compression level which favours a higher compression ratio -- over compression speed, though it does not use the maximum compression -- level. -- -- Use compressWith to adjust the compression level or other -- compression parameters. compress :: ByteString -> ByteString -- | Decompress a stream of data in the gzip format. -- -- There are a number of errors that can occur. In each case an exception -- will be thrown. The possible error conditions are: -- --
-- compressWith defaultCompressParams { ... }
--
--
-- In particular you can set the compression level:
--
--
-- compressWith defaultCompressParams { compressLevel = BestCompression }
--
compressWith :: CompressParams -> ByteString -> ByteString
-- | Like decompress but with the ability to specify various
-- decompression parameters. Typical usage:
--
--
-- decompressWith defaultCompressParams { ... }
--
decompressWith :: DecompressParams -> ByteString -> ByteString
-- | The full set of parameters for compression. The defaults are
-- defaultCompressParams.
--
-- The compressBufferSize is the size of the first output buffer
-- containing the compressed data. If you know an approximate upper bound
-- on the size of the compressed data then setting this parameter can
-- save memory. The default compression output buffer size is
-- 16k. If your extimate is wrong it does not matter too much,
-- the default buffer size will be used for the remaining chunks.
data CompressParams
CompressParams :: CompressionLevel -> Method -> WindowBits -> MemoryLevel -> CompressionStrategy -> Int -> CompressParams
compressLevel :: CompressParams -> CompressionLevel
compressMethod :: CompressParams -> Method
compressWindowBits :: CompressParams -> WindowBits
compressMemoryLevel :: CompressParams -> MemoryLevel
compressStrategy :: CompressParams -> CompressionStrategy
compressBufferSize :: CompressParams -> Int
-- | The default set of parameters for compression. This is typically used
-- with the compressWith function with specific paramaters
-- overridden.
defaultCompressParams :: CompressParams
-- | The full set of parameters for decompression. The defaults are
-- defaultDecompressParams.
--
-- The decompressBufferSize is the size of the first output
-- buffer, containing the uncompressed data. If you know an exact or
-- approximate upper bound on the size of the decompressed data then
-- setting this parameter can save memory. The default decompression
-- output buffer size is 32k. If your extimate is wrong it does
-- not matter too much, the default buffer size will be used for the
-- remaining chunks.
--
-- One particular use case for setting the decompressBufferSize is
-- if you know the exact size of the decompressed data and want to
-- produce a strict Data.ByteString.ByteString. The compression
-- and deccompression functions use lazy
-- Data.ByteString.Lazy.ByteStrings but if you set the
-- decompressBufferSize correctly then you can generate a lazy
-- Data.ByteString.Lazy.ByteString with exactly one chunk, which
-- can be converted to a strict Data.ByteString.ByteString in
-- O(1) time using Data.ByteString.concat .
-- Data.ByteString.Lazy.toChunks.
data DecompressParams
DecompressParams :: WindowBits -> Int -> DecompressParams
decompressWindowBits :: DecompressParams -> WindowBits
decompressBufferSize :: DecompressParams -> Int
-- | The default set of parameters for decompression. This is typically
-- used with the compressWith function with specific paramaters
-- overridden.
defaultDecompressParams :: DecompressParams
-- | The compression level parameter controls the amount of compression.
-- This is a trade-off between the amount of compression and the time
-- required to do the compression.
data CompressionLevel
-- | The default compression level is 6 (that is, biased towards higher
-- compression at expense of speed).
DefaultCompression :: CompressionLevel
-- | No compression, just a block copy.
NoCompression :: CompressionLevel
-- | The fastest compression method (less compression)
BestSpeed :: CompressionLevel
-- | The slowest compression method (best compression).
BestCompression :: CompressionLevel
-- | A specific compression level between 1 and 9.
CompressionLevel :: Int -> CompressionLevel
-- | The compression method
data Method
-- | 'Deflate' is the only method supported in this version of zlib. Indeed
-- it is likely to be the only method that ever will be supported.
Deflated :: Method
-- | This specifies the size of the compression window. Larger values of
-- this parameter result in better compression at the expense of higher
-- memory usage.
--
-- The compression window size is the value of the the window bits raised
-- to the power 2. The window bits must be in the range 8..15
-- which corresponds to compression window sizes of 256b to 32Kb. The
-- default is 15 which is also the maximum size.
--
-- The total amount of memory used depends on the window bits and the
-- MemoryLevel. See the MemoryLevel for the details.
data WindowBits
DefaultWindowBits :: WindowBits
WindowBits :: Int -> WindowBits
-- | The MemoryLevel parameter specifies how much memory should be
-- allocated for the internal compression state. It is a tradoff between
-- memory usage, compression ratio and compression speed. Using more
-- memory allows faster compression and a better compression ratio.
--
-- The total amount of memory used for compression depends on the
-- WindowBits and the MemoryLevel. For decompression it
-- depends only on the WindowBits. The totals are given by the
-- functions:
--
-- -- compressTotal windowBits memLevel = 4 * 2^windowBits + 512 * 2^memLevel -- decompressTotal windowBits = 2^windowBits ---- -- For example, for compression with the default windowBits = 15 -- and memLevel = 8 uses 256Kb. So for example a -- network server with 100 concurrent compressed streams would use -- 25Mb. The memory per stream can be halved (at the cost of -- somewhat degraded and slower compressionby) by reducing the -- windowBits and memLevel by one. -- -- Decompression takes less memory, the default windowBits = 15 -- corresponds to just 32Kb. data MemoryLevel -- | The default. (Equivalent to MemoryLevel 8) DefaultMemoryLevel :: MemoryLevel -- | Use minimum memory. This is slow and reduces the compression ratio. -- (Equivalent to MemoryLevel 1) MinMemoryLevel :: MemoryLevel -- | Use maximum memory for optimal compression speed. (Equivalent to -- MemoryLevel 9) MaxMemoryLevel :: MemoryLevel -- | Use a specific level in the range 1..9 MemoryLevel :: Int -> MemoryLevel -- | 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. data CompressionStrategy -- | Use the DefaultStrategy for normal data. DefaultStrategy :: CompressionStrategy -- | Use 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. Filtered :: CompressionStrategy -- | Use HuffmanOnly to force Huffman encoding only (no string -- match). HuffmanOnly :: CompressionStrategy