use of com.linkedin.r2.filter.compression.streaming.SnappyCompressor in project rest.li by linkedin.
the class TestStreamingCompression method testSnappyCompressor.
@Test
public void testSnappyCompressor() throws IOException, InterruptedException, CompressionException, ExecutionException {
StreamingCompressor compressor = new SnappyCompressor(_executor);
final byte[] origin = new byte[BUF_SIZE];
Arrays.fill(origin, (byte) 'a');
ByteArrayOutputStream out = new ByteArrayOutputStream();
SnappyFramedOutputStream snappy = new SnappyFramedOutputStream(out);
IOUtils.write(origin, snappy);
snappy.close();
byte[] compressed = out.toByteArray();
testCompress(compressor, origin, compressed);
testDecompress(compressor, origin, compressed);
testCompressThenDecompress(compressor, origin);
}
use of com.linkedin.r2.filter.compression.streaming.SnappyCompressor in project rest.li by linkedin.
the class TestStreamingCompression method testSnappyCompressor.
@Test
public void testSnappyCompressor() throws IOException, InterruptedException, CompressionException, ExecutionException {
StreamingCompressor compressor = new SnappyCompressor(_executor);
final byte[] origin = new byte[BUF_SIZE];
Arrays.fill(origin, (byte) 'a');
ByteArrayOutputStream out = new ByteArrayOutputStream();
SnappyFramedOutputStream snappy = new SnappyFramedOutputStream(out);
IOUtils.write(origin, snappy);
snappy.close();
byte[] compressed = out.toByteArray();
testCompress(compressor, origin, compressed);
testDecompress(compressor, origin, compressed);
testCompressThenDecompress(compressor, origin);
}
Aggregations