snappy-framing-0.1.0: Snappy Framing Format in Haskell

Portabilitynon-portable (GHC extensions)
Stabilityexperimental
MaintainerKim Altintop <kim.altintop@gmail.com>
Safe HaskellNone

Codec.Compression.Snappy.Framing

Contents

Description

 

Synopsis

Exported Types

Encoding and Decoding

encode :: ByteString -> (Chunk, Maybe ByteString)Source

Encode a lazy ByteString into a Chunk

If the input is longer than minCompressible bytes, the resulting chunk is Compressed otherwise Uncompressed. If the input size exceeds maxUncompressed bytes, the leftover input is returned in a Just.

encode' :: ByteString -> (Chunk, Maybe ByteString)Source

Encode a strict ByteString into a Chunk

If the input is longer than minCompressible bytes, the resulting chunk is Compressed otherwise Uncompressed. If the input size exceeds maxUncompressed bytes, the leftover input is returned in a Just.

decodeMSource

Arguments

:: Monad m 
=> m (Maybe ByteString)

And action that will be run to provide input. If it returns Nothing it is assumed no more input is available.

-> m (Either DecodeError Chunk, Maybe ByteString)

Either a parse error or a Chunk, along with leftovers if any.

Decode drawing input from the given monadic action as needed

Utility functions

checksum :: ByteString -> ChecksumSource

Compute a masked CRC32C checksum of the input

streamIdentifier :: ByteStringSource

Yield a stream identifier (start-of-stream marker)

verify :: Chunk -> Maybe ChunkSource

Verify a Chunk

Returns Nothing if the input is an Unskippable chunk, or the checksum verification fails (if the input is a Compressed or Uncompressed chunk). Otherwise, the input Chunk is returned in a Just. Note that Compressed chunks are decompressed into Uncompressed chunks on the fly.