Package org.apache.hadoop.io.compress
Class ZStandardCodec
java.lang.Object
org.apache.hadoop.io.compress.ZStandardCodec
- All Implemented Interfaces:
Configurable,CompressionCodec,DirectDecompressionCodec
public class ZStandardCodec
extends Object
implements Configurable, CompressionCodec, DirectDecompressionCodec
This class creates zstd compressors/decompressors.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.hadoop.io.compress.CompressionCodec
CompressionCodec.Util -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidCreate a newCompressorfor use by thisCompressionCodec.Create a newDecompressorfor use by thisCompressionCodec.Create a newDirectDecompressorfor use by thisDirectDecompressionCodec.Create aCompressionInputStreamthat will read from the given input stream.createInputStream(InputStream in, Decompressor decompressor) Create aCompressionInputStreamthat will read from the givenInputStreamwith the givenDecompressor.Create aCompressionOutputStreamthat will write to the givenOutputStream.createOutputStream(OutputStream out, Compressor compressor) Create aCompressionOutputStreamthat will write to the givenOutputStreamwith the givenCompressor.static intstatic intClass<? extends Compressor>Get the type ofCompressorneeded by thisCompressionCodec.getConf()Return the configuration used by this object.static intClass<? extends Decompressor>Get the type ofDecompressorneeded by thisCompressionCodec.Get the default filename extension for this kind of compression.static Stringstatic booleanvoidsetConf(Configuration conf) Set the configuration to be used by this object.
-
Constructor Details
-
ZStandardCodec
public ZStandardCodec()
-
-
Method Details
-
setConf
Set the configuration to be used by this object.- Specified by:
setConfin interfaceConfigurable- Parameters:
conf- the configuration object.
-
getConf
Return the configuration used by this object.- Specified by:
getConfin interfaceConfigurable- Returns:
- the configuration object used by this object.
-
checkNativeCodeLoaded
public static void checkNativeCodeLoaded() -
isNativeCodeLoaded
public static boolean isNativeCodeLoaded() -
getLibraryName
-
getCompressionLevel
-
getCompressionBufferSize
-
getDecompressionBufferSize
-
createOutputStream
Create aCompressionOutputStreamthat will write to the givenOutputStream.- Specified by:
createOutputStreamin interfaceCompressionCodec- Parameters:
out- the location for the final output stream- Returns:
- a stream the user can write uncompressed data to have compressed
- Throws:
IOException- raised on errors performing I/O.
-
createOutputStream
public CompressionOutputStream createOutputStream(OutputStream out, Compressor compressor) throws IOException Create aCompressionOutputStreamthat will write to the givenOutputStreamwith the givenCompressor.- Specified by:
createOutputStreamin interfaceCompressionCodec- Parameters:
out- the location for the final output streamcompressor- compressor to use- Returns:
- a stream the user can write uncompressed data to have compressed
- Throws:
IOException- raised on errors performing I/O.
-
getCompressorType
Get the type ofCompressorneeded by thisCompressionCodec.- Specified by:
getCompressorTypein interfaceCompressionCodec- Returns:
- the type of compressor needed by this codec.
-
createCompressor
Create a newCompressorfor use by thisCompressionCodec.- Specified by:
createCompressorin interfaceCompressionCodec- Returns:
- a new compressor for use by this codec
-
createInputStream
Create aCompressionInputStreamthat will read from the given input stream.- Specified by:
createInputStreamin interfaceCompressionCodec- Parameters:
in- the stream to read compressed bytes from- Returns:
- a stream to read uncompressed bytes from
- Throws:
IOException- raised on errors performing I/O.
-
createInputStream
public CompressionInputStream createInputStream(InputStream in, Decompressor decompressor) throws IOException Create aCompressionInputStreamthat will read from the givenInputStreamwith the givenDecompressor.- Specified by:
createInputStreamin interfaceCompressionCodec- Parameters:
in- the stream to read compressed bytes fromdecompressor- decompressor to use- Returns:
- a stream to read uncompressed bytes from
- Throws:
IOException- raised on errors performing I/O.
-
getDecompressorType
Get the type ofDecompressorneeded by thisCompressionCodec.- Specified by:
getDecompressorTypein interfaceCompressionCodec- Returns:
- the type of decompressor needed by this codec.
-
createDecompressor
Create a newDecompressorfor use by thisCompressionCodec.- Specified by:
createDecompressorin interfaceCompressionCodec- Returns:
- a new decompressor for use by this codec
-
getDefaultExtension
Get the default filename extension for this kind of compression.- Specified by:
getDefaultExtensionin interfaceCompressionCodec- Returns:
.zst.
-
createDirectDecompressor
Description copied from interface:DirectDecompressionCodecCreate a newDirectDecompressorfor use by thisDirectDecompressionCodec.- Specified by:
createDirectDecompressorin interfaceDirectDecompressionCodec- Returns:
- a new direct decompressor for use by this codec
-