/** * Return the appropriate implementation of the zlib compressor. * * @param conf configuration * @return the appropriate implementation of the zlib compressor. */ public static Compressor getZlibCompressor(Configuration conf) { return (isNativeZlibLoaded(conf)) ? new ZlibCompressor(conf) : new BuiltInZlibDeflater(ZlibFactory.getCompressionLevel(conf).compressionLevel()); }
/** * Return the appropriate implementation of the zlib decompressor. * * @param conf configuration * @return the appropriate implementation of the zlib decompressor. */ public static Decompressor getZlibDecompressor(Configuration conf) { return (isNativeZlibLoaded(conf)) ? new ZlibDecompressor() : new BuiltInZlibInflater(); }
@Override public DirectDecompressor createDirectDecompressor() { return ZlibFactory.isNativeZlibLoaded(conf) ? new ZlibDecompressor.ZlibDirectDecompressor( ZlibDecompressor.CompressionHeader.AUTODETECT_GZIP_ZLIB, 0) : null; }
@Override public Class<? extends Decompressor> getDecompressorType() { return ZlibFactory.isNativeZlibLoaded(conf) ? GzipZlibDecompressor.class : BuiltInGzipDecompressor.class; }
@Override public Decompressor createDecompressor() { return (ZlibFactory.isNativeZlibLoaded(conf)) ? new GzipZlibDecompressor() : new BuiltInGzipDecompressor(); }
/** * Returns the total number of uncompressed bytes input so far.</p> * * @return the total (non-negative) number of uncompressed bytes input so far */ @Override public long getBytesRead() { checkStream(); return getBytesRead(stream); }
/** * Returns the total number of uncompressed bytes output so far. * * @return the total (non-negative) number of uncompressed bytes output so far */ public long getBytesWritten() { checkStream(); return getBytesWritten(stream); }
/** * Returns the total number of compressed bytes input so far.</p> * * @return the total (non-negative) number of compressed bytes input so far */ public long getBytesRead() { checkStream(); return getBytesRead(stream); }
/** * Creates a new compressor, taking settings from the configuration. */ public ZlibCompressor(Configuration conf) { this(ZlibFactory.getCompressionLevel(conf), ZlibFactory.getCompressionStrategy(conf), CompressionHeader.DEFAULT_HEADER, DEFAULT_DIRECT_BUFFER_SIZE); }
/** * Returns the number of bytes remaining in the input buffers; normally * called when finished() is true to determine amount of post-gzip-stream * data.</p> * * @return the total (non-negative) number of unprocessed bytes in input */ @Override public int getRemaining() { checkStream(); return userBufLen + getRemaining(stream); // userBuf + compressedDirectBuf }
/** * Returns the total number of compressed bytes output so far. * * @return the total (non-negative) number of compressed bytes output so far */ @Override public long getBytesWritten() { checkStream(); return getBytesWritten(stream); }
@Override public void reset() { super.reset(); endOfInput = true; }
@Override public void end() { if (stream != 0) { end(stream); stream = 0; } }
@Override public void end() { if (stream != 0) { end(stream); stream = 0; } }
/** * {@inheritDoc} */ @Override public DirectDecompressor createDirectDecompressor() { return ZlibFactory.getZlibDirectDecompressor(conf); }
/** * Return the appropriate implementation of the zlib direct decompressor. * * @param conf configuration * @return the appropriate implementation of the zlib decompressor. */ public static DirectDecompressor getZlibDirectDecompressor(Configuration conf) { return (isNativeZlibLoaded(conf)) ? new ZlibDecompressor.ZlibDirectDecompressor() : null; }
/** * Return the appropriate type of the zlib decompressor. * * @param conf configuration * @return the appropriate type of the zlib decompressor. */ public static Class<? extends Decompressor> getZlibDecompressorType(Configuration conf) { return (isNativeZlibLoaded(conf)) ? ZlibDecompressor.class : BuiltInZlibInflater.class; }
public GzipZlibCompressor(Configuration conf) { super(ZlibFactory.getCompressionLevel(conf), ZlibFactory.getCompressionStrategy(conf), ZlibCompressor.CompressionHeader.GZIP_FORMAT, 64 * 1024); } }
/** * Return the appropriate type of the zlib compressor. * * @param conf configuration * @return the appropriate type of the zlib compressor. */ public static Class<? extends Compressor> getZlibCompressorType(Configuration conf) { return (isNativeZlibLoaded(conf)) ? ZlibCompressor.class : BuiltInZlibDeflater.class; }
@Override public Class<? extends Compressor> getCompressorType() { return ZlibFactory.isNativeZlibLoaded(conf) ? GzipZlibCompressor.class : null; }