Snappywrap.Block (snappywrap v0.1.1)
View SourceStore uncompressed data in Snappy block format.
In this wrapper implementation, each block can only be an uncompressed (literal) data block.
Snappy output has the following format:
preamble
-varint block size
stream
: composedof
onlyliterals
in this wrapper implementation
Preamble The stream starts with the uncompressed length (up to a maximum of 2^32 - 1), stored as a little-endian varint. Varints consist of a series of bytes, where the lower 7 bits are data and the upper bit is set iff there are more bytes to be read. In other words, an uncompressed length of 64 would be stored as 0x40, and an uncompressed length of 2097150 (0x1FFFFE) would be stored as 0xFE 0xFF 0x7F.
Compressed stream of Literals (00) Literals are uncompressed data stored directly in the byte stream. The literal length is stored differently depending on the length of the literal:
- For literals up to and including 60 bytes in length, the upper six bits of the tag byte contain (len-1). The literal follows immediately thereafter in the bytestream.
- For longer literals, the (len-1) value is stored after the tag byte, little-endian. The upper six bits of the tag byte describe how many bytes are used for the length; 60, 61, 62 or 63 for 1-4 bytes, respectively. The literal itself follows after the length.
Summary
Functions
Encodes as uncompressed data in Snappy block
format.