public final class Snappy
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
(package private) static int |
COPY_1_BYTE_OFFSET |
(package private) static int |
COPY_2_BYTE_OFFSET |
(package private) static int |
COPY_4_BYTE_OFFSET |
(package private) static int |
LITERAL |
private static int |
MAX_HEADER_LENGTH |
| Modifier | Constructor and Description |
|---|---|
private |
Snappy() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
compress(byte[] data) |
static int |
compress(byte[] uncompressed,
int uncompressedOffset,
int uncompressedLength,
byte[] compressed,
int compressedOffset) |
static java.io.InputStream |
determineSnappyInputStream(java.io.InputStream source,
boolean verifyChecksums)
Uses the stream marker bytes to determine if the
SnappyFramedInputStream or
SnappyInputStream should be used to decompress the content of source. |
static int |
getUncompressedLength(byte[] compressed,
int compressedOffset) |
static int |
maxCompressedLength(int sourceLength) |
static byte[] |
uncompress(byte[] compressed,
int compressedOffset,
int compressedSize) |
static int |
uncompress(byte[] compressed,
int compressedOffset,
int compressedSize,
byte[] uncompressed,
int uncompressedOffset) |
private static final int MAX_HEADER_LENGTH
static final int LITERAL
static final int COPY_1_BYTE_OFFSET
static final int COPY_2_BYTE_OFFSET
static final int COPY_4_BYTE_OFFSET
public static java.io.InputStream determineSnappyInputStream(java.io.InputStream source,
boolean verifyChecksums)
throws java.io.IOException
SnappyFramedInputStream or
SnappyInputStream should be used to decompress the content of source.source - The compressed content to decompress. Must support InputStream.mark(int).verifyChecksums - Indicates if the crc32-c checksums should be calculated and verified.InputStream implementation to decompress the content.java.lang.IllegalArgumentException - If source does not support mark/reset or does not contain the appropriate marker bytes for either implementation.java.io.IOExceptionpublic static int getUncompressedLength(byte[] compressed,
int compressedOffset)
throws CorruptionException
CorruptionExceptionpublic static byte[] uncompress(byte[] compressed,
int compressedOffset,
int compressedSize)
throws CorruptionException
CorruptionExceptionpublic static int uncompress(byte[] compressed,
int compressedOffset,
int compressedSize,
byte[] uncompressed,
int uncompressedOffset)
throws CorruptionException
CorruptionExceptionpublic static int maxCompressedLength(int sourceLength)
public static int compress(byte[] uncompressed,
int uncompressedOffset,
int uncompressedLength,
byte[] compressed,
int compressedOffset)
public static byte[] compress(byte[] data)