Z-IO-0.1.8.0: Simple and high performance IO toolkit for Haskell
Copyright(c) Dong Han 2017-2018
LicenseBSD
Maintainerwinterland1989@gmail.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Z.IO.BIO.Zlib

Description

This module provides zlib bindings using BIO interface.

Synopsis

Compression

data CompressConfig Source #

Instances

Instances details
Eq CompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

Ord CompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

Show CompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

Generic CompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

Associated Types

type Rep CompressConfig :: Type -> Type #

ShowT CompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

type Rep CompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

type Rep CompressConfig = D1 ('MetaData "CompressConfig" "Z.IO.BIO.Zlib" "Z-IO-0.1.8.0-7YhFIAPi9HDI1OeLA2mSRE" 'False) (C1 ('MetaCons "CompressConfig" 'PrefixI 'True) ((S1 ('MetaSel ('Just "compressLevel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 CompressLevel) :*: (S1 ('MetaSel ('Just "compressWindowBits") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WindowBits) :*: S1 ('MetaSel ('Just "compressMemoryLevel") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 MemLevel))) :*: (S1 ('MetaSel ('Just "compressDictionary") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bytes) :*: (S1 ('MetaSel ('Just "compressStrategy") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Strategy) :*: S1 ('MetaSel ('Just "compressBufferSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int)))))

newCompress :: HasCallStack => CompressConfig -> IO (ZStream, BIO Bytes Bytes) Source #

Compress all the data written to a output.

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 #

Decompress some bytes.

compressBlocks :: HasCallStack => CompressConfig -> [Bytes] -> [Bytes] Source #

Decompress some bytes list.

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.

type MemLevel = CInt Source #

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.

Decompression

data DecompressConfig Source #

Instances

Instances details
Eq DecompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

Ord DecompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

Show DecompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

Generic DecompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

Associated Types

type Rep DecompressConfig :: Type -> Type #

ShowT DecompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

type Rep DecompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

type Rep DecompressConfig = D1 ('MetaData "DecompressConfig" "Z.IO.BIO.Zlib" "Z-IO-0.1.8.0-7YhFIAPi9HDI1OeLA2mSRE" 'False) (C1 ('MetaCons "DecompressConfig" 'PrefixI 'True) (S1 ('MetaSel ('Just "decompressWindowBits") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 WindowBits) :*: (S1 ('MetaSel ('Just "decompressDictionary") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Bytes) :*: S1 ('MetaSel ('Just "decompressBufferSize") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Int))))

newDecompress :: DecompressConfig -> IO (ZStream, BIO Bytes Bytes) Source #

Decompress bytes from source.

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 list.

Constants

Strategy

pattern Z_RLE :: Strategy Source #

CompressLevel