Package org.xerial.snappy
package org.xerial.snappy
Snappy API for compressing/decompressing data.
Usage
First, import
Snappy
in your Java code:
import org.xerial.snappy.Snappy;
Then use Snappy.compress(byte[])
and Snappy.uncompress(byte[])
:
String input = "Hello snappy-java! Snappy-java is a JNI-based wrapper of Snappy, a fast compresser/decompresser.";
byte[] compressed = Snappy.compress(input.getBytes("UTF-8"));
byte[] uncompressed = Snappy.uncompress(compressed);
String result = new String(uncompressed, "UTF-8");
System.out.println(result);
In addition, high-level methods (Snappy.compress(String), Snappy.compress(float[] ..) etc. ) and low-level ones (e.g. Snappy.rawCompress(.. ), Snappy.rawUncompress(..), etc.), which minimize memory copies, can be used.
Stream-based API
Stream-based compressor/decompressor SnappyOutputStream, SnappyInputStream are also available for reading/writing large data sets.-
ClassDescriptionJNI interfaces of the
BitShuffle
implementation.Type codes used in ByteBuffer based BitShuffle APIsProvides OS name and architecture name.A pure-java implementation of the CRC32 checksum that uses the CRC32-C polynomial, the same polynomial used by iSCSI and implemented on many Intel chipsets supporting SSE4.2.Snappy API for data compression/decompressionSnappy compressor/decompressor interface.OSGi bundle entry pointPreamble header forSnappyOutputStream
.Used when serious errors (unchecked exception) are observed.Error codes of snappy-javaDeprecated.Constants and utilities for implementing x-snappy-framed.A stream filter for reading data compressed bySnappyOutputStream
.Enhanced IOException with SnappyErrorCodeInternal only - Do not use this class. This class loads a native library of snappy-java (snappyjava.dll, libsnappy.so, etc.) according to the user platform (os.name and os.arch).JNI interface of theSnappy
implementation.This class implements a stream filter for writing compressed data using Snappy.
IOException