Safe Haskell | Safe-Infered |
---|
- enumInflate :: MonadIO m => Format -> DecompressParams -> Enumeratee ByteString ByteString m a
- enumDeflate :: MonadIO m => Format -> CompressParams -> Enumeratee ByteString ByteString m a
- data ZLibParamsException
- data ZLibException
- = NeedDictionary
- | BufferError
- | StreamError
- | DataError
- | MemoryError
- | VersionError
- | Unexpected !CInt
- | IncorrectState
- data CompressParams = CompressParams {}
- defaultCompressParams :: CompressParams
- data DecompressParams = DecompressParams {}
- defaultDecompressParams :: DecompressParams
- data Format
- = GZip
- | Zlib
- | Raw
- | GZipOrZlib
- data CompressionLevel
- data Method = Deflated
- data WindowBits
- data MemoryLevel
- data CompressionStrategy
- enumSyncFlush :: Monad m => Enumerator ByteString m a
- enumFullFlush :: Monad m => Enumerator ByteString m a
- enumBlockFlush :: Monad m => Enumerator ByteString m a
Enumeratees
enumInflate :: MonadIO m => Format -> DecompressParams -> Enumeratee ByteString ByteString m aSource
Decompress the input and send to inner iteratee. If there is end of zlib stream it is left unprocessed.
:: MonadIO m | |
=> Format | Format of input |
-> CompressParams | Parameters of compression |
-> Enumeratee ByteString ByteString m a |
Compress the input and send to inner iteratee.
Exceptions
data ZLibParamsException Source
Denotes error is user-supplied parameter
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
NeedDictionary | Decompression requires user-supplied dictionary (not supported) |
BufferError | Buffer error - denotes a library error | File Error |
StreamError | State of steam inconsistent |
DataError | Input data corrupted |
MemoryError | Not enough memory |
VersionError | Version error |
Unexpected !CInt | Unexpected or unknown error - please report as bug |
IncorrectState | Incorrect state - denotes error in library |
Parameters
data CompressParams Source
Set of parameters for compression. For sane defaults use
defaultCompressParams
CompressParams | |
|
data DecompressParams Source
Set of parameters for decompression. For sane defaults see
defaultDecompressParams
.
DecompressParams | |
|
Specify the format for compression and decompression
GZip | The gzip format is widely used and uses a header with checksum and some optional metadata about the compress file. It is intended primarily for compressing individual files but is also used for network protocols such as HTTP. The format is described in RFC 1952 http://www.ietf.org/rfc/rfc1952.txt. |
Zlib | The zlib format uses a minimal header with a checksum but no other metadata. It is designed for use in network protocols. The format is described in RFC 1950 http://www.ietf.org/rfc/rfc1950.txt |
Raw | The 'raw' format is just the DEFLATE compressed data stream without and additionl headers. Thr format is described in RFC 1951 http://www.ietf.org/rfc/rfc1951.txt |
GZipOrZlib |
data CompressionLevel Source
The compression level specify the tradeoff between speed and compression.
DefaultCompression | Default compression level set at 6. |
NoCompression | No compression, just a block copy. |
BestSpeed | The fastest compression method (however less compression) |
BestCompression | The best compression method (however slowest) |
CompressionLevel Int | Compression level set by number from 1 to 9 |
Specify the compression method.
Deflated | 'Deflate' is so far the only method supported. |
data WindowBits Source
This specify the size of compression level. Larger values result in better compression at the expense of highier memory usage.
The compression window size is 2 to the power of the value of the window bits.
The total memory used depends on windows bits and MemoryLevel
.
WindowBits Int | The size of window bits. It have to be between |
DefaultWindowBits | The default window size which is 4kiB |
data MemoryLevel Source
The MemoryLevel
specifies how much memory should be allocated for the
internal state. It is a tradeoff between memory usage, speed and
compression.
Using more memory allows faster and better compression.
The memory used for interal state, excluding WindowBits
, is 512 bits times
2 to power of memory level.
The total amount of memory use depends on the WindowBits
and
MemoryLevel
.
DefaultMemoryLevel | Default memory level set to 8. |
MinMemoryLevel | Use the small amount of memory (equivalent to memory level 1) - i.e. 1024b or 256 B. It slow and reduces the compresion ratio. |
MaxMemoryLevel | Maximum memory level for optimal compression speed (equivalent to memory level 9). The internal state is 256kib or 32kiB. |
MemoryLevel Int | A specific level. It have to be between 1 and 9. |
data CompressionStrategy Source
Tunes the compress algorithm but does not affact the correctness.
DefaultStrategy | Default strategy |
Filtered | Use 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 |
HuffmanOnly | Use the Huffman-only compression strategy to force Huffman encoding only (no string match). |
enumSyncFlush :: Monad m => Enumerator ByteString m aSource
Enumerate synchronise flush. It cause the all pending output to be flushed and all available input is sent to inner Iteratee.
enumFullFlush :: Monad m => Enumerator ByteString m aSource
Enumerate full flush. It flushes all pending output and reset the compression. It allows to restart from this point if compressed data was corrupted but it can affect the compression rate.
It may be only used during compression.
enumBlockFlush :: Monad m => Enumerator ByteString m aSource
Enumerate block flush. If the enumerator is compressing it allows to finish current block. If the enumerator is decompressing it forces to stop on next block boundary.