@InterfaceAudience.Public @InterfaceStability.Evolving public class CompressionCodecFactory extends Object
Modifier and Type | Field and Description |
---|---|
static org.apache.commons.logging.Log |
LOG |
Constructor and Description |
---|
CompressionCodecFactory(Configuration conf)
Find the codecs specified in the config value io.compression.codecs
and register them.
|
Modifier and Type | Method and Description |
---|---|
CompressionCodec |
getCodec(Path file)
Find the relevant compression codec for the given file based on its
filename suffix.
|
CompressionCodec |
getCodecByClassName(String classname)
Find the relevant compression codec for the codec's canonical class name.
|
CompressionCodec |
getCodecByName(String codecName)
Find the relevant compression codec for the codec's canonical class name
or by codec alias.
|
Class<? extends CompressionCodec> |
getCodecClassByName(String codecName)
Find the relevant compression codec for the codec's canonical class name
or by codec alias and returns its implemetation class.
|
static List<Class<? extends CompressionCodec>> |
getCodecClasses(Configuration conf)
Get the list of codecs discovered via a Java ServiceLoader, or
listed in the configuration.
|
static void |
main(String[] args)
A little test program.
|
static String |
removeSuffix(String filename,
String suffix)
Removes a suffix from a filename, if it has it.
|
static void |
setCodecClasses(Configuration conf,
List<Class> classes)
Sets a list of codec classes in the configuration.
|
String |
toString()
Print the extension map out as a string.
|
public static final org.apache.commons.logging.Log LOG
public CompressionCodecFactory(Configuration conf)
public static List<Class<? extends CompressionCodec>> getCodecClasses(Configuration conf)
conf
- the configuration to look inCompressionCodec
classespublic static void setCodecClasses(Configuration conf, List<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(String classname)
classname
- the canonical class name of the codecpublic CompressionCodec getCodecByName(String codecName)
codecName
- the canonical class name of the codecpublic Class<? extends CompressionCodec> getCodecClassByName(String codecName)
codecName
- the canonical class name of the codecpublic static String removeSuffix(String filename, String suffix)
filename
- the filename to stripsuffix
- the suffix to removeCopyright © 2018 Apache Software Foundation. All rights reserved.