Top Description Interfaces Classes Enums
[default module]

Package org.xerial.snappy


Snappy API for compressing/decompressing data.

Usage First, import org.xerial.snappy.Snappy in your Java code:

import org.xerial.snappy.Snappy;
Then use org.xerial.snappy.Snappy#compress(byte[]) and org.xerial.snappy.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.

Interface Summary

Modifier and TypeInterface and Description
public interface
SnappyApi

Snappy compressor/decompressor interface.

Class Summary

Modifier and TypeClass and Description
public class
public class
BitShuffleNative

JNI interfaces of the BitShuffle implementation.

public class
OSInfo

Provides OS name and architecture name.

public class
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.

public class
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.

public class
SnappyBundleActivator

OSGi bundle entry point

public class
SnappyCodec

Preamble header for SnappyOutputStream.

public class
SnappyError

Used when serious errors (unchecked exception) are observed.

public class
SnappyException

Deprecated Snappy-java now uses IOException
Exception in snappy-java
pack-priv class
SnappyFramed

Constants and utilities for implementing x-snappy-framed.

public class
public class
public class
public class
SnappyInputStream

A stream filter for reading data compressed by SnappyOutputStream.

public class
SnappyIOException

Enhanced IOException with SnappyErrorCode

public class
SnappyLoader

Internal only - Do not use this class.

public class
SnappyNative

JNI interface of the Snappy implementation.

public class
SnappyOutputStream

This class implements a stream filter for writing compressed data using Snappy.

Enum Summary

Modifier and TypeEnum and Description
public enum
BitShuffleType

Type codes used in ByteBuffer based BitShuffle APIs

public enum
SnappyErrorCode

Error codes of snappy-java