snappy-framed-0.1.0.0: Decompression for framed Snappy streams

Safe HaskellNone
LanguageHaskell2010

Codec.Compression.Snappy.Framed.SnappyJava

Description

A format developed as part of the snappy-java library.

From the docs:

SnappyOutputStream and SnappyInputStream use `[magic header:16
bytes]([block size:int32][compressed data:byte array])*` format

The following example encoding was produced on an x86 machine, yet the "block size" int32 appears to be big-endian. Therefore, I'm assuming that this is an unwritten part of the spec.

Example encoding of the string "foobar\n":

00000000  82 53 4e 41 50 50 59 00  00 00 00 01 00 00 00 01  |.SNAPPY.........|
00000010  00 00 00 09 07 18 66 6f  6f 62 61 72 0a           |......foobar.|

Reference: http://code.google.com/p/snappy-java/

Synopsis

Documentation

parseHeader :: Parser () Source

Attempt to parse the header. If the header exists, it will be consumed. If not, the parser will fail.

parseBlock :: Parser ByteString Source

Parse a single block of the compressed bytestream, returning a segment of the uncompressed stream.