io-streams-1.5.2.2: Simple, composable, and easy-to-use stream I/O

Safe Haskell | None
Language | Haskell2010

System.IO.Streams.Zlib

Contents

- ByteString decompression
- ByteString compression
- Builder compression
- Compression level

Description

Interface to `zlib` and `gzip` compression for `Bytestring`s and `Builder`s

Synopsis

- gunzip :: InputStream ByteString -> IO (InputStream ByteString)
- decompress :: InputStream ByteString -> IO (InputStream ByteString)
- gzip :: CompressionLevel -> OutputStream ByteString -> IO (OutputStream ByteString)
- compress :: CompressionLevel -> OutputStream ByteString -> IO (OutputStream ByteString)
- gzipBuilder :: CompressionLevel -> OutputStream Builder -> IO (OutputStream Builder)
- compressBuilder :: CompressionLevel -> OutputStream Builder -> IO (OutputStream Builder)
- newtype CompressionLevel = CompressionLevel Int
- defaultCompressionLevel :: CompressionLevel

# ByteString decompression

gunzip :: InputStream ByteString -> IO (InputStream ByteString) Source #

Decompress an `InputStream` of strict `ByteString`s from the `gzip` format

decompress :: InputStream ByteString -> IO (InputStream ByteString) Source #

Decompress an `InputStream` of strict `ByteString`s from the `zlib` format

# ByteString compression

gzip :: CompressionLevel -> OutputStream ByteString -> IO (OutputStream ByteString) Source #

Convert an `OutputStream` that consumes compressed `ByteString`s into an `OutputStream` that consumes uncompressed `ByteString`s in the `gzip` format

compress :: CompressionLevel -> OutputStream ByteString -> IO (OutputStream ByteString) Source #

Convert an `OutputStream` that consumes compressed `ByteString`s into an `OutputStream` that consumes uncompressed `ByteString`s in the `zlib` format

# Builder compression

gzipBuilder :: CompressionLevel -> OutputStream Builder -> IO (OutputStream Builder) Source #

Convert an `OutputStream` that consumes compressed `Builder`s into an `OutputStream` that consumes uncompressed `Builder`s in the `gzip` format

compressBuilder :: CompressionLevel -> OutputStream Builder -> IO (OutputStream Builder) Source #

Convert an `OutputStream` that consumes compressed `Builder`s into an `OutputStream` that consumes uncompressed `Builder`s in the `zlib` format

# Compression level

newtype CompressionLevel Source #

Parameter that defines the tradeoff between speed and compression ratio

Constructors

CompressionLevel Int |

#### Instances

Instances details

Num CompressionLevel Source # |

Instance details

Defined in System.IO.Streams.Zlib

Methods

(+) :: CompressionLevel -> CompressionLevel -> CompressionLevel Source #

(-) :: CompressionLevel -> CompressionLevel -> CompressionLevel Source #

(*) :: CompressionLevel -> CompressionLevel -> CompressionLevel Source #

negate :: CompressionLevel -> CompressionLevel Source #

abs :: CompressionLevel -> CompressionLevel Source #

signum :: CompressionLevel -> CompressionLevel Source #

fromInteger :: Integer -> CompressionLevel Source #

Read CompressionLevel Source # |
Instance details Defined in System.IO.Streams.Zlib Methods readsPrec :: Int -> ReadS CompressionLevel Source # readList :: ReadS [CompressionLevel] Source # readPrec :: ReadPrec CompressionLevel Source # readListPrec :: ReadPrec [CompressionLevel] Source #
Show CompressionLevel Source # |
Instance details Defined in System.IO.Streams.Zlib Methods showsPrec :: Int -> CompressionLevel -> ShowS Source # show :: CompressionLevel -> String Source # showList :: [CompressionLevel] -> ShowS Source #
Eq CompressionLevel Source # |
Instance details Defined in System.IO.Streams.Zlib Methods (==) :: CompressionLevel -> CompressionLevel -> Bool Source # (/=) :: CompressionLevel -> CompressionLevel -> Bool Source #

defaultCompressionLevel :: CompressionLevel Source #

A compression level that balances speed with compression ratio