Search in sources :

Example 1 with SnappyDecompressor

use of org.apache.hadoop.io.compress.snappy.SnappyDecompressor in project hadoop by apache.

the class TestCompressorDecompressor method testCompressorDecompressorWithExeedBufferLimit.

@Test
public void testCompressorDecompressorWithExeedBufferLimit() {
    int BYTE_SIZE = 100 * 1024;
    byte[] rawData = generate(BYTE_SIZE);
    try {
        CompressDecompressTester.of(rawData).withCompressDecompressPair(new SnappyCompressor(BYTE_SIZE + BYTE_SIZE / 2), new SnappyDecompressor(BYTE_SIZE + BYTE_SIZE / 2)).withCompressDecompressPair(new Lz4Compressor(BYTE_SIZE), new Lz4Decompressor(BYTE_SIZE)).withTestCases(ImmutableSet.of(CompressionTestStrategy.COMPRESS_DECOMPRESS_SINGLE_BLOCK, CompressionTestStrategy.COMPRESS_DECOMPRESS_BLOCK, CompressionTestStrategy.COMPRESS_DECOMPRESS_ERRORS, CompressionTestStrategy.COMPRESS_DECOMPRESS_WITH_EMPTY_STREAM)).test();
    } catch (Exception ex) {
        GenericTestUtils.assertExceptionContains("testCompressorDecompressorWithExeedBufferLimit error !!!", ex);
    }
}
Also used : SnappyDecompressor(org.apache.hadoop.io.compress.snappy.SnappyDecompressor) SnappyCompressor(org.apache.hadoop.io.compress.snappy.SnappyCompressor) Lz4Compressor(org.apache.hadoop.io.compress.lz4.Lz4Compressor) Lz4Decompressor(org.apache.hadoop.io.compress.lz4.Lz4Decompressor) Test(org.junit.Test)

Example 2 with SnappyDecompressor

use of org.apache.hadoop.io.compress.snappy.SnappyDecompressor in project hadoop by apache.

the class TestCompressorDecompressor method testCompressorDecompressor.

@Test
public void testCompressorDecompressor() {
    // no more for this data
    int SIZE = 44 * 1024;
    byte[] rawData = generate(SIZE);
    try {
        CompressDecompressTester.of(rawData).withCompressDecompressPair(new SnappyCompressor(), new SnappyDecompressor()).withCompressDecompressPair(new Lz4Compressor(), new Lz4Decompressor()).withCompressDecompressPair(new BuiltInZlibDeflater(), new BuiltInZlibInflater()).withTestCases(ImmutableSet.of(CompressionTestStrategy.COMPRESS_DECOMPRESS_SINGLE_BLOCK, CompressionTestStrategy.COMPRESS_DECOMPRESS_BLOCK, CompressionTestStrategy.COMPRESS_DECOMPRESS_ERRORS, CompressionTestStrategy.COMPRESS_DECOMPRESS_WITH_EMPTY_STREAM)).test();
    } catch (Exception ex) {
        GenericTestUtils.assertExceptionContains("testCompressorDecompressor error !!!", ex);
    }
}
Also used : BuiltInZlibInflater(org.apache.hadoop.io.compress.zlib.BuiltInZlibInflater) SnappyDecompressor(org.apache.hadoop.io.compress.snappy.SnappyDecompressor) SnappyCompressor(org.apache.hadoop.io.compress.snappy.SnappyCompressor) Lz4Compressor(org.apache.hadoop.io.compress.lz4.Lz4Compressor) Lz4Decompressor(org.apache.hadoop.io.compress.lz4.Lz4Decompressor) BuiltInZlibDeflater(org.apache.hadoop.io.compress.zlib.BuiltInZlibDeflater) Test(org.junit.Test)

Aggregations

Lz4Compressor (org.apache.hadoop.io.compress.lz4.Lz4Compressor)2 Lz4Decompressor (org.apache.hadoop.io.compress.lz4.Lz4Decompressor)2 SnappyCompressor (org.apache.hadoop.io.compress.snappy.SnappyCompressor)2 SnappyDecompressor (org.apache.hadoop.io.compress.snappy.SnappyDecompressor)2 Test (org.junit.Test)2 BuiltInZlibDeflater (org.apache.hadoop.io.compress.zlib.BuiltInZlibDeflater)1 BuiltInZlibInflater (org.apache.hadoop.io.compress.zlib.BuiltInZlibInflater)1