Add a simple test
This commit is contained in:
parent
8cb7b2064c
commit
d90c7fa7d8
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue