@Public
@Evolving
public class CompressionCodecFactory
extends java.lang.Object
| Modifier and Type | Field | Description |
|---|---|---|
static org.slf4j.Logger |
LOG |
| Constructor | Description |
|---|---|
CompressionCodecFactory(Configuration conf) |
Find the codecs specified in the config value io.compression.codecs
and register them.
|
| Modifier and Type | Method | Description |
|---|---|---|
CompressionCodec |
getCodec(Path file) |
Find the relevant compression codec for the given file based on its
filename suffix.
|
CompressionCodec |
getCodecByClassName(java.lang.String classname) |
Find the relevant compression codec for the codec's canonical class name.
|
CompressionCodec |
getCodecByName(java.lang.String codecName) |
Find the relevant compression codec for the codec's canonical class name
or by codec alias.
|
java.lang.Class<? extends CompressionCodec> |
getCodecClassByName(java.lang.String codecName) |
Find the relevant compression codec for the codec's canonical class name
or by codec alias and returns its implemetation class.
|
static java.util.List<java.lang.Class<? extends CompressionCodec>> |
getCodecClasses(Configuration conf) |
Get the list of codecs discovered via a Java ServiceLoader, or
listed in the configuration.
|
static void |
main(java.lang.String[] args) |
A little test program.
|
static java.lang.String |
removeSuffix(java.lang.String filename,
java.lang.String suffix) |
Removes a suffix from a filename, if it has it.
|
static void |
setCodecClasses(Configuration conf,
java.util.List<java.lang.Class> classes) |
Sets a list of codec classes in the configuration.
|
java.lang.String |
toString() |
Print the extension map out as a string.
|
public CompressionCodecFactory(Configuration conf)
conf - configuration.public java.lang.String toString()
toString in class java.lang.Objectpublic static java.util.List<java.lang.Class<? extends CompressionCodec>> getCodecClasses(Configuration conf)
conf - the configuration to look inCompressionCodec classespublic static void setCodecClasses(Configuration conf, java.util.List<java.lang.Class> classes)
CompressionCodec classes on
the classpath are discovered using a Java ServiceLoader.conf - the configuration to modifyclasses - the list of classes to setpublic CompressionCodec getCodec(Path file)
file - the filename to checkpublic CompressionCodec getCodecByClassName(java.lang.String classname)
classname - the canonical class name of the codecpublic CompressionCodec getCodecByName(java.lang.String codecName)
Codec aliases are case insensitive.
The code alias is the short class name (without the package name). If the short class name ends with 'Codec', then there are two aliases for the codec, the complete short class name and the short class name without the 'Codec' ending. For example for the 'GzipCodec' codec class name the alias are 'gzip' and 'gzipcodec'.
codecName - the canonical class name of the codecpublic java.lang.Class<? extends CompressionCodec> getCodecClassByName(java.lang.String codecName)
Codec aliases are case insensitive.
The code alias is the short class name (without the package name). If the short class name ends with 'Codec', then there are two aliases for the codec, the complete short class name and the short class name without the 'Codec' ending. For example for the 'GzipCodec' codec class name the alias are 'gzip' and 'gzipcodec'.
codecName - the canonical class name of the codecpublic static java.lang.String removeSuffix(java.lang.String filename,
java.lang.String suffix)
filename - the filename to stripsuffix - the suffix to removepublic static void main(java.lang.String[] args)
throws java.lang.Exception
args - arguments.java.lang.Exception - exception.Copyright © 2008–2025 Apache Software Foundation. All rights reserved.