iteratee-compress-0.1: An enumerators for compressing and decompressing streams

Data.Iteratee.ZLib

Synopsis

Documentation

data ZLibParamsException Source

Denotes error is user-supplied parameter

Constructors

IncorrectCompressionLevel !Int

Incorrect compression level was chosen

IncorrectWindowBits !Int

Incorrect number of window bits was chosen

IncorrectMemoryLevel !Int

Incorrect memory level was chosen

data ZLibException Source

Denotes error in compression and decompression

Constructors

NeedDictionary

Decompression requires user-supplied dictionary (not supported)

BufferError

Buffer error - denotes the library error | File Error

StreamError

State of steam inconsistent

DataError

Input data corrupted

MemoryError

Not enought memory

VersionError

Version error

Unexpected !CInt

Unexpected or unknown error - please report as bug

IncorrectState

Incorrect state - denotes error in library

data CompressParams

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 DecompressParams

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 Format

The format used for compression or decompression. There are three variations.

Constructors

GZip 
Zlib 
Raw 
GZipOrZlib 

Instances

enumInflate :: MonadIO m => Format -> DecompressParams -> Enumerator ByteString m aSource

Decompress the input and send to inner iteratee. If there is end of zlib stream it is left unprocessed.

enumDeflateSource

Arguments

:: MonadIO m 
=> Format

Format of input

-> CompressParams

Parameters of compression

-> Enumerator ByteString m a 

Compress the input and send to inner iteratee.