org.xerial.snappy (Snappy for Java 1.0.4.1-SNAPSHOT API)
Date: 2011-09-26

Package | Class | Use | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

## Package org.xerial.snappy

Snappy API for compressing/decompressing data.

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.

## Package org.xerial.snappy Description

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.

Package | Class | Use | Tree | Deprecated | Index | Help
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES

Copyright © 2011 xerial.org. All Rights Reserved.