Package org.xerial.snappy
Class SnappyFramed
java.lang.Object
org.xerial.snappy.SnappyFramed
Constants and utilities for implementing x-snappy-framed.
- Since:
- 1.1.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final byte[]
The header consists of the stream identifier flag, 3 bytes indicating a length of 6, and "sNaPpY" in ASCII.private static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Checksum
static int
mask
(int crc) Checksums are not stored directly, but masked, as checksumming data and then its own checksum can be problematic.static int
maskedCrc32c
(Checksum crc32c, byte[] data, int offset, int length) (package private) static final int
readBytes
(ReadableByteChannel source, ByteBuffer dest) (package private) static int
skip
(ReadableByteChannel source, int skip, ByteBuffer buffer)
-
Field Details
-
COMPRESSED_DATA_FLAG
public static final int COMPRESSED_DATA_FLAG- See Also:
-
UNCOMPRESSED_DATA_FLAG
public static final int UNCOMPRESSED_DATA_FLAG- See Also:
-
STREAM_IDENTIFIER_FLAG
public static final int STREAM_IDENTIFIER_FLAG- See Also:
-
MASK_DELTA
private static final int MASK_DELTA- See Also:
-
CHECKSUM_SUPPLIER
-
HEADER_BYTES
public static final byte[] HEADER_BYTESThe header consists of the stream identifier flag, 3 bytes indicating a length of 6, and "sNaPpY" in ASCII.
-
-
Constructor Details
-
SnappyFramed
SnappyFramed()
-
-
Method Details
-
getCRC32C
-
maskedCrc32c
-
mask
public static int mask(int crc) Checksums are not stored directly, but masked, as checksumming data and then its own checksum can be problematic. The masking is the same as used in Apache Hadoop: Rotate the checksum by 15 bits, then add the constant 0xa282ead8 (using wraparound as normal for unsigned integers). This is equivalent to the following C code:uint32_t mask_checksum(uint32_t x) { return ((x >> 15) | (x invalid input: '<'invalid input: '<' 17)) + 0xa282ead8; }
-
readBytes
- Throws:
IOException
-
skip
- Throws:
IOException
-