Skip to content

jiechic/Snappy-Android

Repository files navigation

Snappy-Android

License Jcenter

snappy-android is a android port of the snappy http://code.google.com/p/snappy/, a fast C++ compresser/decompresser developed by Google.

Installation

Using JCenter:

repositories {
    jcenter()
}

dependencies {
    compile 'com.jiechic.android.library:snappy-android:1.1.7'
}

Usage

First, import com.jiechic.library.android.snappy.Snappy in your Java code:

import com.jiechic.library.android.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.

Snappy-Android is developed by Jiechic. Twitter @jiechic

Thanks

https://github.com/google/snappy

https://github.com/xerial/snappy-java

About

A fast compressor/decompressor for Android https://github.com/google/snappy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published