úÎÑÊïS      !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRportable (H98 + FFI) provisionalduncan@haskell.org Safe-InferedBThe strategy parameter is used to tune the compression algorithm. FThe strategy parameter only affects the compression ratio but not the K correctness of the compressed output even if it is not set appropriately. The 9 parameter specifies how much memory should be allocated K for the internal compression state. It is a tradoff between memory usage, J 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:  I 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 G 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. IThis specifies the size of the compression window. Larger values of this H parameter result in better compression at the expense of higher memory  usage. JThe compression window size is the value of the the window bits raised to 3 the power 2. The window bits must be in the range 8..15 which corresponds N to compression window sizes of 256b to 32Kb. The default is 15 which is also  the maximum size. CThe total amount of memory used depends on the window bits and the   . See the  for the details. IThe compression level parameter controls the amount of compression. This N is a trade-off between the amount of compression and the time required to do  the compression. The compression method BThe format used for compression or decompression. There are three  variations. S9No progress was possible or there was not enough room in  the output buffer when T is used. Note that   BuferError is not fatal, and U can be called < again with more input and more output space to continue. JThe gzip format uses a header with a checksum and some optional meta-data E about the compressed file. It is intended primarily for compressing K individual files but is also sometimes used for network protocols such as 0 HTTP. The format is described in detail in RFC #1952   #http://www.ietf.org/rfc/rfc1952.txt CThe zlib format uses a minimal header with a checksum but no other H 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 The 'raw'7 format is just the compressed data stream without any H additional header, meta-data or data-integrity checksum. The format is  described in detail in RFC #1951  #http://www.ietf.org/rfc/rfc1951.txt DThis is not a format as such. It enabled zlib or gzip decoding with F automatic header detection. This only makes sense for decompression. 'Deflate'7 is the only method supported in this version of zlib. H Indeed it is likely to be the only method that ever will be supported. CThe default compression level is 6 (that is, biased towards higher # compression at expense of speed). #No compression, just a block copy. 2The fastest compression method (less compression) !3The 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) &DUse minimum memory. This is slow and reduces the compression ratio.  (Equivalent to ( 1) '2Use maximum memory for optimal compression speed.  (Equivalent to ( 9) (A specific level in the range 1..9 )7Use this default compression strategy for normal data. *HUse the filtered compression strategy for data produced by a filter (or K predictor). Filtered data consists mostly of small values with a somewhat J random distribution. In this case, the compression algorithm is tuned to L compress them better. The effect of this strategy is to force more Huffman F coding and less string matching; it is somewhat intermediate between  defaultCompressionStrategy and huffmanOnlyCompressionStrategy. +IUse the Huffman-only compression strategy to force Huffman encoding only  (no string match). V)This never needs to be used as the stream's resources will be released J automatically when no longer needed, however this can be used to release J them early. Only use this when you can guarantee that the stream will no I longer be needed, for example if an error occurs or if the stream ends. O WTXYZ[\]S^_`abcdefghijklmnoUpqr !"#$%&'()*+stVuN WTXYZ[\]S^_`abcdefghijklmnoUpqr !"#$%&'()*+stV-   WZYXT[ba`_^S]\cfedghijklmnoUpqr !"#$%&'()*+stVuportable (H98 + FFI) provisionalduncan@haskell.org Safe-Infered,6The possible error cases when decompressing a stream. -DIf the compressed data stream is corrupted in any way then you will 7 get this error, for example if the input data just isn't a compressed F zlib data stream. In particular if the data checksum turns out to be I wrong then you will get all the decompressed data but this error at the & end, instead of the normal sucessful 3. .EIt is possible to do zlib compression with a custom dictionary. This I allows slightly higher compression ratios for short files. However such I compressed streams require the same dictionary when decompressing. This I zlib binding does not currently support custom dictionaries. This error G is for when we encounter a compressed stream that needs a dictionary. /EThe compressed data stream ended prematurely. This may happen if the " input data stream was truncated. 0:A sequence of chunks of data produced from decompression. JThe difference from a simple list is that it contains a representation of K errors as data rather than as exceptions. This allows you to handle error  conditions explicitly. 12An error code and a human readable error message. 4?The full set of parameters for decompression. The defaults are  A. The 7) is the size of the first output buffer, M containing the uncompressed data. If you know an exact or approximate upper L 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 M 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 7 is if you K know the exact size of the decompressed data and want to produce a strict  /. 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    .  . 8=The full set of parameters for compression. The defaults are  @. The ?3 is the size of the first output buffer containing L the compressed data. If you know an approximate upper bound on the size of N 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 M not matter too much, the default buffer size will be used for the remaining  chunks. @KThe default set of parameters for compression. This is typically used with  the  compressWith/ function with specific parameters overridden. AMThe default set of parameters for decompression. This is typically used with  the  compressWith/ function with specific parameters overridden. BFold an DecompressionStream . Just like v but with an extra error F case. For example to convert to a list and translate the errors into  exceptions: 6 foldDecompressStream (:) [] (\code msg -> error msg) C Convert a 0 to a lazy  ByteString. If any decompression < errors are encountered then they are thrown as exceptions. This is a special case of B. DCompress a data stream. MThere are no expected error conditions. All input data streams are valid. It L is possible for unexpected errors to occur, such as running out of memory, I or finding the wrong version of the zlib C library, these are thrown as  exceptions. EDecompress a data stream. MIt will throw an exception if any error is encountered in the input data. If 4 you need more control over error handling then use F. FLike E but returns a 0 data structure that J contains an explicit representation of the error conditions that one may  encounter when decompressing. LNote that in addition to errors in the input data, it is possible for other I unexpected errors to occur, such as out of memory, or finding the wrong N version of the zlib C library, these are still thrown as exceptions (because = representing them as data would make this function impure). ,-./0123456789:;<=>?@ABCDEFG  !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGD89:;<=>?@E4567A   !" #$%&'()*+F0321,/.-BC ,/.-0321456789:;<=>?@ABCDEFportable (H98 + FFI) provisionalduncan@haskell.org Safe-InferedGHIJ5  !"#$%&'()*+456789:;<=>?@AGHIJ5IGJH89:;<=>?@4567A   !" #$%&'()*+GHIJportable (H98 + FFI) provisionalduncan@haskell.org Safe-InferedK0Decompress a stream of data in the zlib format. LThere are a number of errors that can occur. In each case an exception will / be thrown. The possible error conditions are: 7 if 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 J may not be detected until the end of the stream is demanded (since it is E only at the end that the final checksum can be checked). If this is H important to you, you must make sure to consume the whole decompressed 7 stream before doing any IO action that depends on it. LLike K7 but with the ability to specify various decompression  parameters. Typical usage: . decompressWith defaultCompressParams { ... } M0Compress a stream of data into the zlib format. GThis uses the default compression parameters. In partiular it uses the I default compression level which favours a higher compression ratio over J compression speed, though it does not use the maximum compression level. Use N6 to adjust the compression level or other compression  parameters. NLike M5 but with the ability to specify various compression  parameters. Typical usage:  , compressWith defaultCompressParams { ... } 1In particular you can set the compression level: H compressWith defaultCompressParams { compressLevel = BestCompression } KLMN5  !"#$%&'()*+456789:;<=>?@AKLMN5MKNL89:;<=>?@4567A   !" #$%&'()*+KLMNportable (H98 + FFI) provisionalduncan@haskell.org Safe-InferedO0Decompress a stream of data in the gzip format. LThere are a number of errors that can occur. In each case an exception will / be thrown. The possible error conditions are: 7 if 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 J may not be detected until the end of the stream is demanded (since it is E only at the end that the final checksum can be checked). If this is H important to you, you must make sure to consume the whole decompressed 7 stream before doing any IO action that depends on it. PLike O7 but with the ability to specify various decompression  parameters. Typical usage: . decompressWith defaultCompressParams { ... } Q0Compress a stream of data into the gzip format. GThis uses the default compression parameters. In partiular it uses the I default compression level which favours a higher compression ratio over J compression speed, though it does not use the maximum compression level. Use R6 to adjust the compression level or other compression  parameters. RLike Q5 but with the ability to specify various compression  parameters. Typical usage:  , compressWith defaultCompressParams { ... } 1In particular you can set the compression level: H compressWith defaultCompressParams { compressLevel = BestCompression } OPQR5  !"#$%&'()*+456789:;<=>?@AOPQR5QORP89:;<=>?@4567A   !" #$%&'()*+OPQRw    !"#$%&'()*+,-./0123456789:;<<=>??@ABCDEFGHIJKLKMJNKMJNKMJNOPQRSTUVWXYZ59[\]^;_`abcdefghijklmnopqr zlib-0.5.3.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 StreamEndDecompressParamsdecompressWindowBitsdecompressBufferSizeCompressParams compressLevelcompressMethodcompressWindowBitscompressMemoryLevelcompressStrategycompressBufferSizedefaultCompressParamsdefaultDecompressParamsfoldDecompressStreamfromDecompressStreamcompress decompressdecompressWithErrorsdecompressWith compressWith BufferErrorFinishinflatefinaliseFlush FullFlush SyncFlushNoFlush ErrorCode Unexpected VersionError MemoryError FileErrorNeedDictStatusErrorOkStreampushInputBufferinputBufferEmptypushOutputBufferpopOutputBufferoutputBufferBytesAvailableoutputBufferSpaceRemainingoutputBufferFulldeflaterun unsafeLiftIOunsafeInterleave inflateInit deflateInit $fMonadStreambaseGHC.Basefoldr