protected CompressionCodec getCodec(CompressionCodecName codecName) {
    String codecClassName = codecName.getHadoopCompressionCodecClassName();
    if (codecClassName == null) {
      return null;
    }
    CompressionCodec codec = CODEC_BY_NAME.get(codecClassName);
    if (codec != null) {
      return codec;
    }

    try {
      Class<?> codecClass = Class.forName(codecClassName);
      codec = (CompressionCodec) ReflectionUtils.newInstance(codecClass, configuration);
      CODEC_BY_NAME.put(codecClassName, codec);
      return codec;
    } catch (ClassNotFoundException e) {
      throw new BadConfigurationException("Class " + codecClassName + " was not found", e);
    }
  }
protected CompressionCodec getCodec ( CompressionCodecName codecName ) { String codecClassName = codecName . getHadoopCompressionCodecClassName ( ) ; if ( codecClassName == null ) { return null ; } CompressionCodec codec = CODEC_BY_NAME . get ( codecClassName ) ; if ( codec != null ) { return codec ; } try { Class < ? > codecClass = Class . forName ( codecClassName ) ; codec = ( CompressionCodec ) ReflectionUtils . newInstance ( codecClass , configuration ) ; CODEC_BY_NAME . put ( codecClassName , codec ) ; return codec ; } catch ( ClassNotFoundException e ) { throw new BadConfigurationException ( "Class " + codecClassName + " was not found" , e ) ; } }
@param codecName
the requested codec
@return the corresponding hadoop codec. null if UNCOMPRESSED