4U      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRST(c) 2006-2008 Duncan Coutts BSD-styleduncan@haskell.org provisionalportable (H98 + FFI)None AThe 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.The  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   and the ,. For decompression it depends only on the  (. The totals are given by the functions: qcompressTotal 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 256KbT. So for example a network server with 100 concurrent compressed streams would use 25Mbt. 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. 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..15s which corresponds to compression window sizes of 256b to 32Kb. The default is 15 which is also the maximum size.DThe total amount of memory used depends on the window bits and the  . See the  for the details. 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.The compression methodNThe format used for compression or decompression. There are three variations.USNo progress was possible or there was not enough room in the output buffer when V is used. Note that  BuferError is not fatal, and WJ can be called again with more input and more output space to continue.XA hash of a custom compression dictionary. These hashes are used by zlib as dictionary identifiers. (The particular hash function used is Adler32.)YUpdate a running X. You can generate a X from one or more Zs by starting from [, e.g. AdictionaryHash zeroDictionaryHash :: ByteString -> DictionaryHashor Jfoldl' dictionaryHash zeroDictionaryHash :: [ByteString] -> DictionaryHash[A zero X" to use as the initial value with Y.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.txtThe 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.txtThe 'raw' format is just the compressed data stream without any additional header, meta-data or data-integrity checksum. The format is described in detail in RFC #1951 #http://www.ietf.org/rfc/rfc1951.txtThis is not a format as such. It enabled zlib or gzip decoding with automatic header detection. This only makes sense for decompression.'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.eThe default compression level is 6 (that is, biased towards higher compression at expense of speed)."No compression, just a block copy. 1The fastest compression method (less compression)!2The slowest compression method (best compression)."-A specific compression level between 0 and 9.# The default  & is 15 which is also the maximum size.$CA specific compression window size, specified in bits in the range 8..15%)The default memory level. (Equivalent to ( 8)&TUse minimum memory. This is slow and reduces the compression ratio. (Equivalent to ( 1)'BUse maximum memory for optimal compression speed. (Equivalent to ( 9)(A specific level in the range 1..9)6Use this default compression strategy for normal data.*pUse the filtered compression strategy 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 this strategy is to force more Huffman coding and less string matching; it is somewhat intermediate between defaultCompressionStrategy and huffmanOnlyCompressionStrategy.+\Use the Huffman-only compression strategy to force Huffman encoding only (no string match).\#This never needs to be used as the stream's resources will be released automatically when no longer needed, however this can be used to release them early. Only use this when you can guarantee that the stream will no longer be needed, for example if an error occurs or if the stream ends.]^ _V`abcdeUfghijklmnopqXrstuvwxyz{|}~WY[ !"#$%&'()*+\T _V`abcdeUfghijklmnoX}~WY[ !"#$%&'()*+\b]^   _ba`VcjihgfUedknmlopqXrstuvwxyz{|}~WY[ !"#$%&'()*+\(c) 2006-2008 Duncan Coutts BSD-styleduncan@haskell.org provisionalportable (H98 + FFI)None ,5The possible error cases when decompressing a stream.-@If the compressed data stream is corrupted in any way then you will get this error, for example if the input data just isn't a compressed zlib data stream. In particular if the data checksum turns out to be wrong then you will get all the decompressed data but this error at the end, instead of the normal sucessful 3..;It is possible to do zlib compression with a custom dictionary. This allows slightly higher compression ratios for short files. However such compressed streams require the same dictionary when decompressing. This error is for when we encounter a compressed stream that needs a dictionary, and it's not provided./fThe compressed data stream ended prematurely. This may happen if the input data stream was truncated.09A sequence of chunks of data produced from decompression.The difference from a simple list is that it contains a representation of errors as data rather than as exceptions. This allows you to handle error conditions explicitly.11An error code and a human readable error message.4@The full set of parameters for decompression. The defaults are C.The 7 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 32ky. 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 7W is if you know the exact size of the decompressed data and want to produce a strict 9. The compression and deccompression functions use lazy s but if you set the 7) correctly then you can generate a lazy = with exactly one chunk, which can be converted to a strict  in O(1) time using   .  .9>The full set of parameters for compression. The defaults are B.The @ 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 16ky. If your extimate is wrong it does not matter too much, the default buffer size will be used for the remaining chunks.BPThe default set of parameters for compression. This is typically used with the  compressWith. function with specific parameters overridden.CRThe default set of parameters for decompression. This is typically used with the  compressWith. function with specific parameters overridden.The default chunk sizes for the output of compression and decompression are 16k and 32k respectively (less a small accounting overhead).The default chunk sizes for the output of compression and decompression are 16k and 32k respectively (less a small accounting overhead).DFold an DecompressionStream . Just like k but with an extra error case. For example to convert to a list and translate the errors into exceptions: 4foldDecompressStream (:) [] (\code msg -> error msg)E Convert a 0 to a lazy  ByteStringR. If any decompression errors are encountered then they are thrown as exceptions.This is a special case of D.FCompress a data stream.There are no expected error conditions. All input data streams are valid. It is possible for unexpected errors to occur, such as running out of memory, or finding the wrong version of the zlib C library, these are thrown as exceptions.GDecompress a data stream.It will throw an exception if any error is encountered in the input data. If you need more control over error handling then use H.HLike G but returns a 0} data structure that contains an explicit representation of the error conditions that one may encounter when decompressing.Note that in addition to errors in the input data, it is possible for other unexpected errors to occur, such as out of memory, or finding the wrong version of the zlib C library, these are still thrown as exceptions (because representing them as data would make this function impure).,-./0123456789:;<=>?@ABCDEFGHI  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIF9:;<=>?@ABG45678C   !" #$%&'()*+H0321,/.-DE ,/.-0321456789:;<=>?@ABCDEFGH(c) 2006-2008 Duncan Coutts BSD-styleduncan@haskell.org provisionalportable (H98 + FFI)None IJKL7  !"#$%&'()*+456789:;<=>?@ABCIJKL7KILJ9:;<=>?@AB45678C   !" #$%&'()*+IJKL(c) 2006-2008 Duncan Coutts BSD-styleduncan@haskell.org provisionalportable (H98 + FFI)None M/Decompress a stream of data in the zlib format.zThere are a number of errors that can occur. In each case an exception will be thrown. The possible error conditions are:5if the stream does not start with a valid gzip header%if the compressed stream is corrupted)if the compressed stream ends permaturely)Note that the decompression is performed lazily). Errors in the data stream may not be detected until the end of the stream is demanded (since it is only at the end that the final checksum can be checked). If this is important to you, you must make sure to consume the whole decompressed stream before doing any IO action that depends on it.NLike MR but with the ability to specify various decompression parameters. Typical usage: ,decompressWith defaultCompressParams { ... }O/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 PB to adjust the compression level or other compression parameters.PLike OP but with the ability to specify various compression parameters. Typical usage: *compressWith defaultCompressParams { ... }0In particular you can set the compression level: FcompressWith defaultCompressParams { compressLevel = BestCompression }MNOP7  !"#$%&'()*+456789:;<=>?@ABCMNOP7OMPN9:;<=>?@AB45678C   !" #$%&'()*+MNOP(c) 2006-2008 Duncan Coutts BSD-styleduncan@haskell.org provisionalportable (H98 + FFI)None Q/Decompress a stream of data in the gzip format.zThere are a number of errors that can occur. In each case an exception will be thrown. The possible error conditions are:5if the stream does not start with a valid gzip header%if the compressed stream is corrupted)if the compressed stream ends permaturely)Note that the decompression is performed lazily). Errors in the data stream may not be detected until the end of the stream is demanded (since it is only at the end that the final checksum can be checked). If this is important to you, you must make sure to consume the whole decompressed stream before doing any IO action that depends on it.RLike QR but with the ability to specify various decompression parameters. Typical usage: ,decompressWith defaultCompressParams { ... }S/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 TB to adjust the compression level or other compression parameters.TLike SP but with the ability to specify various compression parameters. Typical usage: *compressWith defaultCompressParams { ... }0In particular you can set the compression level: FcompressWith defaultCompressParams { compressLevel = BestCompression }QRST7  !"#$%&'()*+456789:;<=>?@ABCQRST7SQTR9:;<=>?@AB45678C   !" #$%&'()*+QRST    !"#$%&'()*+,-./0123456789:;<<=>?@@ABCDEFGHIJKLMNMOLPMOLPMOLPQRSTUVWXYZZ[\]^_`ab59cdef;ghijklmnopqrstuvwxyz{|}~ zlib-0.5.4.2Codec.Compression.Zlib.InternalCodec.Compression.Zlib.RawCodec.Compression.ZlibCodec.Compression.GZipCodec.Compression.Zlib.StreamData.ByteString ByteStringData.ByteString.LazyconcattoChunksCompressionStrategy HuffmanOnlyFilteredDefaultStrategy MemoryLevelMaxMemoryLevelMinMemoryLevelDefaultMemoryLevel WindowBitsDefaultWindowBitsCompressionLevelBestCompression BestSpeed NoCompressionDefaultCompressionMethodDeflatedFormat GZipOrZlibRawZlibGZip gzipFormat zlibFormat rawFormatgzipOrZlibFormat deflateMethoddefaultCompression noCompression bestSpeedbestCompressioncompressionLeveldefaultWindowBits windowBitsdefaultMemoryLevelminMemoryLevelmaxMemoryLevel memoryLeveldefaultStrategyfilteredStrategyhuffmanOnlyStrategyDecompressError DataErrorDictionaryRequiredTruncatedInputDecompressStream StreamError StreamChunk StreamEndDecompressParamsdecompressWindowBitsdecompressBufferSizedecompressDictionaryCompressParams compressLevelcompressMethodcompressWindowBitscompressMemoryLevelcompressStrategycompressBufferSizecompressDictionarydefaultCompressParamsdefaultDecompressParamsfoldDecompressStreamfromDecompressStreamcompress decompressdecompressWithErrorsdecompressWith compressWith BufferErrorFinishinflateDictionaryHashdictionaryHashbytestring-0.10.4.0Data.ByteString.InternalzeroDictionaryHashfinalise StreamStateFlush FullFlush SyncFlushNoFlush ErrorCode Unexpected VersionError MemoryError FileErrorNeedDictStatusErrorOkStreamZunZDictHash c_adler32 c_zlibVersion c_deflateEnd c_deflatec_inflateSetDictionaryc_deflateSetDictionaryc_deflateInit2_ c_inflateEnd c_inflatec_inflateInit2_pushInputBufferinputBufferEmptypushOutputBufferpopOutputBufferoutputBufferBytesAvailableoutputBufferSpaceRemainingoutputBufferFulldeflatedeflateSetDictionaryinflateSetDictionaryreturnZthenZthenZ_failZrun unsafeLiftIOunsafeInterleavegetStreamStategetInBuf getOutBuf getOutOffset getOutAvailsetInBuf setOutBuf setOutOffset setOutAvailtoStatus failIfError fromFlushformatSupportsDictionary fromMethodfromCompressionLevelfromWindowBitsfromMemoryLevelfromCompressionStrategy withStreamPtrwithStreamState setInAvail getInAvail setInNext setOutFree getOutFree setOutNext inflateInit deflateInitinflate_deflate_checkFormatSupportedc_inflateInit2c_deflateInit2 $fMonadStream$fApplicativeStream$fFunctorStreamdefaultCompressBufferSizedefaultDecompressBufferSizebaseGHC.Basefoldr