Copyright | (c) Dong Han 2017-2020 |
---|---|
License | BSD |
Maintainer | winterland1989@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- newCompress :: HasCallStack => CompressConfig -> IO (ZStream, BIO Bytes Bytes)
- compressReset :: ZStream -> IO ()
- compress :: HasCallStack => CompressConfig -> Bytes -> Bytes
- compressBlocks :: HasCallStack => CompressConfig -> [Bytes] -> [Bytes]
- data ZStream
- data CompressConfig = CompressConfig {}
- defaultCompressConfig :: CompressConfig
- newDecompress :: DecompressConfig -> IO (ZStream, BIO Bytes Bytes)
- decompressReset :: ZStream -> IO ()
- decompress :: HasCallStack => DecompressConfig -> Bytes -> Bytes
- decompressBlocks :: HasCallStack => DecompressConfig -> [Bytes] -> [Bytes]
- data DecompressConfig = DecompressConfig {}
- defaultDecompressConfig :: DecompressConfig
- type WindowBits = CInt
- defaultWindowBits :: WindowBits
- type MemLevel = CInt
- defaultMemLevel :: MemLevel
- type Strategy = CInt
- pattern Z_FILTERED :: Strategy
- pattern Z_HUFFMAN_ONLY :: Strategy
- pattern Z_RLE :: Strategy
- pattern Z_FIXED :: Strategy
- pattern Z_DEFAULT_STRATEGY :: Strategy
- type CompressLevel = CInt
- pattern Z_BEST_SPEED :: CompressLevel
- pattern Z_BEST_COMPRESSION :: CompressLevel
- pattern Z_DEFAULT_COMPRESSION :: CompressLevel
Compression
newCompress :: HasCallStack => CompressConfig -> IO (ZStream, BIO Bytes Bytes) Source #
Make a new compress node.
The returned BIO
node can be reused only if you call compressReset
on the ZStream
.
compressReset :: ZStream -> IO () Source #
Reset compressor's state so that related BIO
can be reused.
compress :: HasCallStack => CompressConfig -> Bytes -> Bytes Source #
Compress some bytes.
compressBlocks :: HasCallStack => CompressConfig -> [Bytes] -> [Bytes] Source #
Compress some bytes in blocks.
data CompressConfig Source #
Instances
Decompression
newDecompress :: DecompressConfig -> IO (ZStream, BIO Bytes Bytes) Source #
Make a new decompress node.
The returned BIO
node can be reused only if you call decompressReset
on the ZStream
.
decompressReset :: ZStream -> IO () Source #
Reset decompressor's state so that related BIO
can be reused.
decompress :: HasCallStack => DecompressConfig -> Bytes -> Bytes Source #
Decompress some bytes.
decompressBlocks :: HasCallStack => DecompressConfig -> [Bytes] -> [Bytes] Source #
Decompress some bytes in blocks.
data DecompressConfig Source #
Instances
Constants
Windows bits
type WindowBits = CInt Source #
The WindowBits
is the base two logarithm of the maximum window size (the size of the history buffer).
It should be in the range 8..15 for this version of the library. The defaultWindowBits
value is 15. Decompressing windowBits must be greater than or equal to the compressing windowBits. If a compressed stream with a larger window size is given as input, decompress will throw ZDataError
windowBits can also be –8..–15 for raw inflate. In this case, -windowBits determines the window size. inflate() will then process raw deflate data, not looking for a zlib or gzip header, not generating a check value, and not looking for any check values for comparison at the end of the stream.
windowBits can also be greater than 15 for optional gzip decoding. Add 32 to windowBits to enable zlib and gzip decoding with automatic header detection, or add 16 to decode only the gzip format.
Memory level
The MemLevel
specifies how much memory should be allocated for the internal compression state. 1 uses minimum memory but is slow and reduces compression ratio; 9 uses maximum memory for optimal speed. The default value is 8.
Strategy
pattern Z_FILTERED :: Strategy Source #
pattern Z_HUFFMAN_ONLY :: Strategy Source #
pattern Z_DEFAULT_STRATEGY :: Strategy Source #
CompressLevel
type CompressLevel = CInt Source #
pattern Z_BEST_SPEED :: CompressLevel Source #
pattern Z_BEST_COMPRESSION :: CompressLevel Source #
pattern Z_DEFAULT_COMPRESSION :: CompressLevel Source #