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

Z.IO.BIO.Zlib

Description

This module provides zlib bindings, with BIO streaming interface.

Synopsis

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 ZStream Source #

A foreign pointer to a zlib's z_stream_s struct.

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 #

JSON CompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

Print 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.4.0.0-yZ8PAxRS7u6ehgjyvfzwd" '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)))))

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

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 #

JSON DecompressConfig Source # 
Instance details

Defined in Z.IO.BIO.Zlib

Print 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.4.0.0-yZ8PAxRS7u6ehgjyvfzwd" '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))))

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

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.

Strategy

pattern Z_RLE :: Strategy Source #

CompressLevel