-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Compression and decompression in the bzip2 format -- -- This package provides a pure interface for compressing and -- decompressing streams of data represented as lazy ByteStrings. -- It uses the bz2 C library so it has high performance. -- -- It provides a convenient high level API suitable for most tasks and -- for the few cases where more control is needed it provides access to -- the full bzip2 feature set. @package bzlib @version 0.5.0.3 -- | Pure stream based interface to lower level bzlib wrapper module Codec.Compression.BZip.Internal compress :: CompressParams -> ByteString -> ByteString -- | The full set of parameters for compression. The defaults are -- defaultCompressParams. -- -- The compressBufferSize is the size of the first output buffer -- containing the compressed data. If you know an approximate upper bound -- on the size of the compressed data then setting this parameter can -- save memory. The default compression output buffer size is -- 16k. If your extimate is wrong it does not matter too much, -- the default buffer size will be used for the remaining chunks. data CompressParams CompressParams :: BlockSize -> WorkFactor -> Int -> CompressParams compressBlockSize :: CompressParams -> BlockSize compressWorkFactor :: CompressParams -> WorkFactor compressBufferSize :: CompressParams -> Int -- | The default set of parameters for compression. This is typically used -- with the compressWith function with specific paramaters -- overridden. defaultCompressParams :: CompressParams decompress :: DecompressParams -> ByteString -> ByteString -- | The full set of parameters for decompression. The defaults are -- defaultDecompressParams. -- -- The decompressBufferSize is the size of the first output -- buffer, containing the uncompressed data. If you know an exact or -- approximate upper bound on the size of the decompressed data then -- setting this parameter can save memory. The default decompression -- output buffer size is 32k. If your extimate is wrong it does -- not matter too much, the default buffer size will be used for the -- remaining chunks. -- -- One particular use case for setting the decompressBufferSize is -- if you know the exact size of the decompressed data and want to -- produce a strict ByteString. The compression and deccompression -- functions use lazy ByteStrings but if you set the -- decompressBufferSize correctly then you can generate a lazy -- ByteString with exactly one chunk, which can be converted to a -- strict ByteString in O(1) time using concat -- . toChunks. data DecompressParams DecompressParams :: MemoryLevel -> Int -> DecompressParams decompressMemoryLevel :: DecompressParams -> MemoryLevel decompressBufferSize :: DecompressParams -> Int -- | The default set of parameters for decompression. This is typically -- used with the compressWith function with specific paramaters -- overridden. defaultDecompressParams :: DecompressParams -- | The block size affects both the compression ratio achieved, and the -- amount of memory needed for compression and decompression. -- -- BlockSize 1 through BlockSize 9 -- specify the block size to be 100,000 bytes through 900,000 bytes -- respectively. The default is to use the maximum block size. -- -- Larger block sizes give rapidly diminishing marginal returns. Most of -- the compression comes from the first two or three hundred k of block -- size, a fact worth bearing in mind when using bzip2 on small machines. -- It is also important to appreciate that the decompression memory -- requirement is set at compression time by the choice of block size. -- --
-- compressWith defaultCompressParams { ... }
--
--
-- In particular you can set the compression block size:
--
--
-- compressWith defaultCompressParams { compressBlockSize = BlockSize 1 }
--
compressWith :: CompressParams -> ByteString -> ByteString
-- | Like decompress but with the ability to specify various
-- decompression parameters. Typical usage:
--
--
-- decompressWith defaultDecompressParams { ... }
--
decompressWith :: DecompressParams -> ByteString -> ByteString
-- | The full set of parameters for compression. The defaults are
-- defaultCompressParams.
--
-- The compressBufferSize is the size of the first output buffer
-- containing the compressed data. If you know an approximate upper bound
-- on the size of the compressed data then setting this parameter can
-- save memory. The default compression output buffer size is
-- 16k. If your extimate is wrong it does not matter too much,
-- the default buffer size will be used for the remaining chunks.
data CompressParams
CompressParams :: BlockSize -> WorkFactor -> Int -> CompressParams
compressBlockSize :: CompressParams -> BlockSize
compressWorkFactor :: CompressParams -> WorkFactor
compressBufferSize :: CompressParams -> Int
-- | The default set of parameters for compression. This is typically used
-- with the compressWith function with specific paramaters
-- overridden.
defaultCompressParams :: CompressParams
-- | The full set of parameters for decompression. The defaults are
-- defaultDecompressParams.
--
-- The decompressBufferSize is the size of the first output
-- buffer, containing the uncompressed data. If you know an exact or
-- approximate upper bound on the size of the decompressed data then
-- setting this parameter can save memory. The default decompression
-- output buffer size is 32k. If your extimate is wrong it does
-- not matter too much, the default buffer size will be used for the
-- remaining chunks.
--
-- One particular use case for setting the decompressBufferSize is
-- if you know the exact size of the decompressed data and want to
-- produce a strict ByteString. The compression and deccompression
-- functions use lazy ByteStrings but if you set the
-- decompressBufferSize correctly then you can generate a lazy
-- ByteString with exactly one chunk, which can be converted to a
-- strict ByteString in O(1) time using concat
-- . toChunks.
data DecompressParams
DecompressParams :: MemoryLevel -> Int -> DecompressParams
decompressMemoryLevel :: DecompressParams -> MemoryLevel
decompressBufferSize :: DecompressParams -> Int
-- | The default set of parameters for decompression. This is typically
-- used with the compressWith function with specific paramaters
-- overridden.
defaultDecompressParams :: DecompressParams
-- | The block size affects both the compression ratio achieved, and the
-- amount of memory needed for compression and decompression.
--
-- BlockSize 1 through BlockSize 9
-- specify the block size to be 100,000 bytes through 900,000 bytes
-- respectively. The default is to use the maximum block size.
--
-- Larger block sizes give rapidly diminishing marginal returns. Most of
-- the compression comes from the first two or three hundred k of block
-- size, a fact worth bearing in mind when using bzip2 on small machines.
-- It is also important to appreciate that the decompression memory
-- requirement is set at compression time by the choice of block size.
--
--