SnappyRpcCompressor implements Compressor { public int compress( byte[] uncompressed, int uncompressedOffset, int uncompressedLength, byte[] compressed, int compressedOffset) { return SnappyCompressor.compress(uncompressed, uncompressedOffset, uncompressedLength, compressed, compressedOffset); } SnappyRpcCompressor(); @Override byte[] deCompress(byte[] src); int getUncompressedLength(byte[] compressed, int compressedOffset); byte[] uncompress(byte[] compressed, int compressedOffset, int compressedSize); int uncompress(byte[] compressed, int compressedOffset, int compressedSize, byte[] uncompressed,
                          int uncompressedOffset); int maxCompressedLength(int sourceLength); int compress(
                        byte[] uncompressed,
                        int uncompressedOffset,
                        int uncompressedLength,
                        byte[] compressed,
                        int compressedOffset); @Override byte[] compress(byte[] data);  }
@Test public void testCompress() throws UnsupportedEncodingException { SnappyRpcCompressor compressor = new SnappyRpcCompressor(); String s = "xxxxasdasdasd0as8d0asdkmasldjalsd"; byte[] bs = compressor.compress(s.getBytes("utf-8")); Assert.assertNotNull(s); String s1 = new String(compressor.deCompress(bs), "utf-8"); Assert.assertEquals(s, s1); }