Add a simple test

This commit is contained in:
Taro L. Saito 2011-04-01 11:09:27 +09:00
parent 8cb7b2064c
commit d90c7fa7d8
2 changed files with 13 additions and 2 deletions

View File

@ -34,8 +34,8 @@ import java.io.OutputStream;
* The input data is blocked into 32KB size, and each block is compressed and
* then passed to the given {@link OutputStream}.
*
* The output data format is a sequence of (compressed size, compressed data
* ...) pair.
* The output data format is a sequence of (compressed chunk size, compressed
* data chunk binary...) pair.
*
* @author leo
*

View File

@ -203,4 +203,15 @@ public class SnappyTest
assertEquals(m, m2);
}
@Test
public void simpleUsage() throws Exception {
String input = "Hello snappy-java! Snappy-java is a JNI-based wrapper for using Snappy from Google (written in C++), 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);
}
}