bz2-1.0.1.2: Bindings to libbz2

Safe Haskell | Safe-Inferred
Language | Haskell2010

Codec.Compression.BZip

Contents

- High-level functions.
- Errors
- Miscellany

Description

High-level functions throw `BZError` on error.

Since: 0.1.1.0

Synopsis

- compress :: ByteString -> ByteString
- compressWith :: CInt -> CInt -> ByteString -> ByteString
- decompress :: ByteString -> ByteString
- decompressErr :: ByteString -> Either BZError ByteString
- data BZError
  - = BzConfigError
  - | BzOutbuffFull
  - | BzUnexpectedEof
  - | BzIoError
  - | BzDataErrorMagic
  - | BzDataError
  - | BzMemError
  - | BzParamError
  - | BzSequenceError
  - | BzOk
  - | BzRunOk
  - | BzFlushOk
  - | BzFinishOk
  - | BzStreamEnd
- bZ2BzlibVersion :: String

# High-level functions.

compress :: ByteString -> ByteString Source #

Since: 0.1.1.0

compressWith Source #

Arguments

:: CInt | Block size (`1-9`)
-> CInt | Work factor (`0-250`)
-> ByteString |
-> ByteString |

See bzlib manual for information on compression parameters.

Since: 0.1.1.0

decompress :: ByteString -> ByteString Source #

Don't use this on pathological input; it may not be secure

This does not handle nested streams

Since: 0.1.1.0

decompressErr :: ByteString -> Either BZError ByteString Source #

Return an error rather than throwing an exception.

Since: 1.0.1.0

# Errors

data BZError Source #

Constructors

BzConfigError |
BzOutbuffFull |
BzUnexpectedEof |
BzIoError |
BzDataErrorMagic |
BzDataError |
BzMemError |
BzParamError |
BzSequenceError |
BzOk |
BzRunOk |
BzFlushOk |
BzFinishOk |
BzStreamEnd |

#### Instances

Instances details

Enum BZError Source # |

Instance details

Defined in Codec.Compression.BZip.Foreign.Common

Methods

succ :: BZError -> BZError Source #

pred :: BZError -> BZError Source #

toEnum :: Int -> BZError Source #

fromEnum :: BZError -> Int Source #

enumFrom :: BZError -> [BZError] Source #

enumFromThen :: BZError -> BZError -> [BZError] Source #

enumFromTo :: BZError -> BZError -> [BZError] Source #

enumFromThenTo :: BZError -> BZError -> BZError -> [BZError] Source #

Exception BZError Source # |
Instance details Defined in Codec.Compression.BZip.Foreign.Common Methods toException :: BZError -> SomeException Source # fromException :: SomeException -> Maybe BZError Source # displayException :: BZError -> String Source #
Show BZError Source # |
Instance details Defined in Codec.Compression.BZip.Foreign.Common Methods showsPrec :: Int -> BZError -> ShowS Source # show :: BZError -> String Source # showList :: [BZError] -> ShowS Source #
Eq BZError Source # |
Instance details Defined in Codec.Compression.BZip.Foreign.Common Methods (==) :: BZError -> BZError -> Bool Source # (/=) :: BZError -> BZError -> Bool Source #

# Miscellany

bZ2BzlibVersion :: String Source #