|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||
See:
Description
| Interface Summary | |
|---|---|
| SnappyNativeAPI | Internal only - Do not use this class. Interface to access the native code of Snappy. |
| Class Summary | |
|---|---|
| OSInfo | Provides OS name and architecture name. |
| Snappy | Snappy API for data compression/decompression |
| SnappyBundleActivator | OSGi bundle entry point |
| SnappyCodec | Preamble header for SnappyOutputStream. |
| SnappyInputStream | A stream filter for reading data compressed by SnappyOutputStream. |
| SnappyLoader | Internal 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). |
| SnappyNative | Internal only - Do not use this class. JNI interface of the
SnappyNativeAPI implementation. |
| SnappyOutputStream | This class implements a stream filter for writing compressed data using Snappy. |
| Enum Summary | |
|---|---|
| SnappyErrorCode | Error codes of snappy-java |
| Exception Summary | |
|---|---|
| SnappyException | Deprecated. Snappy-java now uses IOException |
| Error Summary | |
|---|---|
| SnappyError | Used when serious errors (unchecked exception) are observed. |
Snappy API for compressing/decompressing data.
Usage
First, import Snappy in your Java code:
Then use
import org.xerial.snappy.Snappy;
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.
|
|||||||||
| PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES | ||||||||