Package org.iq80.snappy
Class Snappy
java.lang.Object
org.iq80.snappy.Snappy
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final int(package private) static final int(package private) static final int(package private) static final intprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]compress(byte[] data) static intcompress(byte[] uncompressed, int uncompressedOffset, int uncompressedLength, byte[] compressed, int compressedOffset) static InputStreamdetermineSnappyInputStream(InputStream source, boolean verifyChecksums) Uses the stream marker bytes to determine if theSnappyFramedInputStreamorSnappyInputStreamshould be used to decompress the content of source.static intgetUncompressedLength(byte[] compressed, int compressedOffset) static intmaxCompressedLength(int sourceLength) static byte[]uncompress(byte[] compressed, int compressedOffset, int compressedSize) static intuncompress(byte[] compressed, int compressedOffset, int compressedSize, byte[] uncompressed, int uncompressedOffset)
-
Field Details
-
MAX_HEADER_LENGTH
private static final int MAX_HEADER_LENGTH -
LITERAL
static final int LITERAL- See Also:
-
COPY_1_BYTE_OFFSET
static final int COPY_1_BYTE_OFFSET- See Also:
-
COPY_2_BYTE_OFFSET
static final int COPY_2_BYTE_OFFSET- See Also:
-
COPY_4_BYTE_OFFSET
static final int COPY_4_BYTE_OFFSET- See Also:
-
-
Constructor Details
-
Snappy
private Snappy()
-
-
Method Details
-
determineSnappyInputStream
public static InputStream determineSnappyInputStream(InputStream source, boolean verifyChecksums) throws IOException Uses the stream marker bytes to determine if theSnappyFramedInputStreamorSnappyInputStreamshould be used to decompress the content of source.- Parameters:
source- The compressed content to decompress. Mustsupport}invalid @link
{@link InputStream#mark(int).verifyChecksums- Indicates if the crc32-c checksums should be calculated and verified.- Returns:
- An appropriate
InputStreamimplementation to decompress the content. - Throws:
IllegalArgumentException- If source does notsupportmark/reset or does not contain the appropriate marker bytes for either implementation.IOException
-
getUncompressedLength
public static int getUncompressedLength(byte[] compressed, int compressedOffset) throws CorruptionException - Throws:
CorruptionException
-
uncompress
public static byte[] uncompress(byte[] compressed, int compressedOffset, int compressedSize) throws CorruptionException - Throws:
CorruptionException
-
uncompress
public static int uncompress(byte[] compressed, int compressedOffset, int compressedSize, byte[] uncompressed, int uncompressedOffset) throws CorruptionException - Throws:
CorruptionException
-
maxCompressedLength
public static int maxCompressedLength(int sourceLength) -
compress
public static int compress(byte[] uncompressed, int uncompressedOffset, int uncompressedLength, byte[] compressed, int compressedOffset) -
compress
public static byte[] compress(byte[] data)
-