CompressionCodecFactory (Hadoop 1.2.1 API)
Date: 2013-07-22

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.hadoop.io.compress
Class CompressionCodecFactory

    java.lang.Object
      org.apache.hadoop.io.compress.CompressionCodecFactory

    public class CompressionCodecFactory

extends Object

A factory that will find the correct codec for a given filename.

Field Summary
`static org.apache.commons.logging.Log` | `LOG`

Constructor Summary
`CompressionCodecFactory(Configuration conf)` Find the codecs specified in the config value io.compression.codecs and register them.

Method Summary
`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 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.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### LOG

    public static final org.apache.commons.logging.Log LOG

Constructor Detail

### CompressionCodecFactory

    public CompressionCodecFactory(Configuration conf)

  Find the codecs specified in the config value io.compression.codecs and register them. Defaults to gzip and zip.

Method Detail

### toString

    public String toString()

  Print the extension map out as a string.

  Overrides:
    `toString` in class `Object`

### getCodecClasses

    public static List<Class<? extends CompressionCodec>> getCodecClasses(Configuration conf)

  Get the list of codecs listed in the configuration

  Parameters:
    `conf` - the configuration to look in
  Returns:
    a list of the Configuration classes or null if the attribute was not set

### setCodecClasses

    public static void setCodecClasses(Configuration conf,
                                       List<Class> classes)

  Sets a list of codec classes in the configuration.

  Parameters:
    `conf` - the configuration to modify
    `classes` - the list of classes to set

### getCodec

    public CompressionCodec getCodec(Path file)

  Find the relevant compression codec for the given file based on its filename suffix.

  Parameters:
    `file` - the filename to check
  Returns:
    the codec object

### getCodecByClassName

    public CompressionCodec getCodecByClassName(String classname)

  Find the relevant compression codec for the codec's canonical class name.

  Parameters:
    `classname` - the canonical class name of the codec
  Returns:
    the codec object

### getCodecByName

    public CompressionCodec getCodecByName(String codecName)

  Find the relevant compression codec for the codec's canonical class name or by codec alias.

  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'.

  Parameters:
    `codecName` - the canonical class name of the codec
  Returns:
    the codec object

### getCodecClassByName

    public 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.

  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'.

  Parameters:
    `codecName` - the canonical class name of the codec
  Returns:
    the codec class

### removeSuffix

    public static String removeSuffix(String filename,
                                      String suffix)

  Removes a suffix from a filename, if it has it.

  Parameters:
    `filename` - the filename to strip
    `suffix` - the suffix to remove
  Returns:
    the shortened filename

### main

    public static void main(String[] args)
                     throws Exception

  A little test program.

  Parameters:
    `args` -
  Throws:
    `Exception`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation