biohazard-1.0.4: bioinformatics support library

Safe HaskellNone
LanguageHaskell2010

Bio.Iteratee.ZLib

Contents

Synopsis

Enumeratees

enumInflate :: MonadIO m => Format -> DecompressParams -> Enumeratee ByteString ByteString m a Source #

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

enumInflateAny :: MonadIO m => Enumeratee ByteString ByteString m a Source #

Inflate if Gzip format is recognized, otherwise pass through.

enumDeflate Source #

Arguments

:: 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

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

Constructors

CompressParams 

Fields

data DecompressParams Source #

Set of parameters for decompression. For sane defaults see defaultDecompressParams.

Constructors

DecompressParams 

Fields

data Format Source #

Specify the format for compression and decompression

Constructors

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

Format for decompressing a Zlib or GZip stream.

Instances
Eq Format Source # 
Instance details

Defined in Bio.Iteratee.ZLib

Methods

(==) :: Format -> Format -> Bool #

(/=) :: Format -> Format -> Bool #

data CompressionLevel Source #

The compression level specify the tradeoff between speed and compression.

Constructors

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

data Method Source #

Specify the compression method.

Constructors

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.

Constructors

WindowBits Int

The size of window bits. It have to be between 8 (which corresponds to 256b i.e. 32B) and 15 (which corresponds to 32 kib i.e. 4kiB).

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.

Constructors

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.

Constructors

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 DefaultStrategy and HuffmanOnly.

HuffmanOnly

Use the Huffman-only compression strategy to force Huffman encoding only (no string match).

enumSyncFlush :: Monad m => Enumerator ByteString m a Source #

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

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

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.