From d90c7fa7d865348b12407869000daa8c033e3dde Mon Sep 17 00:00:00 2001 From: "Taro L. Saito" Date: Fri, 1 Apr 2011 11:09:27 +0900 Subject: [PATCH] Add a simple test --- .../java/org/xerial/snappy/SnappyOutputStream.java | 4 ++-- src/test/java/org/xerial/snappy/SnappyTest.java | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/xerial/snappy/SnappyOutputStream.java b/src/main/java/org/xerial/snappy/SnappyOutputStream.java index ddfd394..d056803 100755 --- a/src/main/java/org/xerial/snappy/SnappyOutputStream.java +++ b/src/main/java/org/xerial/snappy/SnappyOutputStream.java @@ -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 * diff --git a/src/test/java/org/xerial/snappy/SnappyTest.java b/src/test/java/org/xerial/snappy/SnappyTest.java index 434e72c..6412275 100755 --- a/src/test/java/org/xerial/snappy/SnappyTest.java +++ b/src/test/java/org/xerial/snappy/SnappyTest.java @@ -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); + + } + }