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