Class | Description |
---|---|
OSInfo |
Provides OS name and architecture name.
|
PureJavaCrc32C |
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 |
Snappy API for data compression/decompression
Note: if the native libraries cannot be loaded, an ExceptionInInitializerError
will be thrown at first use of this class.
|
SnappyBundleActivator |
OSGi bundle entry point
|
SnappyCodec |
Preamble header for
SnappyOutputStream . |
SnappyFramedInputStream | |
SnappyFramedInputStream.FrameData | |
SnappyFramedInputStream.FrameMetaData | |
SnappyFramedOutputStream | |
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 |
JNI interface of the
Snappy implementation. |
SnappyOutputStream |
This class implements a stream filter for writing compressed data using
Snappy.
|
Enum | Description |
---|---|
SnappyErrorCode |
Error codes of snappy-java
|
Exception | Description |
---|---|
SnappyException | Deprecated
Snappy-java now uses
IOException |
SnappyIOException |
Enhanced IOException with SnappyErrorCode
|
Error | Description |
---|---|
SnappyError |
Used when serious errors (unchecked exception) are observed.
|
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.
Copyright © 2011–2024 xerial.org. All rights reserved.