Example usage for org.apache.hadoop.io.compress CompressionCodec getCompressorType

List of usage examples for org.apache.hadoop.io.compress CompressionCodec getCompressorType

Introduction

In this page you can find the example usage for org.apache.hadoop.io.compress CompressionCodec getCompressorType.

Prototype

Class<? extends Compressor> getCompressorType();

Source Link

Document

Get the type of Compressor needed by this CompressionCodec .

Usage

From source file:com.streamsets.pipeline.stage.destination.hdfs.BaseHdfsTargetIT.java

License:Apache License

@Test
public void testSDCSnappyCompressionCodec() throws Exception {
    Assert.assertNotNull(CompressionMode.SNAPPY.getCodec().getField("SDC"));
    CompressionCodec codec = CompressionMode.SNAPPY.getCodec().newInstance();
    Assert.assertNotNull(codec.getCompressorType().getField("SDC"));
    Assert.assertNotNull(codec.getDecompressorType().getField("SDC"));
}

From source file:data.intelligence.platform.yarn.etl.io.CodecPool.java

License:Apache License

/**
 * Get a {@link Compressor} for the given {@link CompressionCodec} from the
 * pool or a new one.//from w ww .ja  v a2 s  .c o  m
 * 
 * @param codec
 *            the <code>CompressionCodec</code> for which to get the
 *            <code>Compressor</code>
 * @return <code>Compressor</code> for the given
 *         <code>CompressionCodec</code> from the pool or a new one
 */
public static Compressor getCompressor(CompressionCodec codec) {
    Compressor compressor = borrow(COMPRESSOR_POOL, codec.getCompressorType());
    if (compressor == null) {
        compressor = codec.createCompressor();
        LOG.info("Got brand-new compressor");
    } else {
        LOG.debug("Got recycled compressor");
    }
    return compressor;
}

From source file:org.apache.tajo.storage.compress.CodecPool.java

License:Apache License

/**
 * Get a {@link Compressor} for the given {@link CompressionCodec} from the
 * pool or a new one./*from   w  w w.  j  a v  a  2  s . co m*/
 *
 * @param codec
 *          the <code>CompressionCodec</code> for which to get the
 *          <code>Compressor</code>
 * @param conf the <code>Configuration</code> object which contains confs for creating or reinit the compressor
 * @return <code>Compressor</code> for the given <code>CompressionCodec</code>
 *         from the pool or a new one
 */
public static Compressor getCompressor(CompressionCodec codec, Configuration conf) {
    Compressor compressor = borrow(COMPRESSOR_POOL, codec.getCompressorType());
    if (compressor == null) {
        compressor = codec.createCompressor();
        LOG.info("Got brand-new compressor [" + codec.getDefaultExtension() + "]");
    } else {
        compressor.reinit(conf);
        if (LOG.isDebugEnabled()) {
            LOG.debug("Got recycled compressor");
        }
    }
    return compressor;
}