/**
* Get the codec string associated with this <code>configuration</code>
*
* @param configuration the {@link Configuration}
* @return the codec {@link String}
*/
public static String getCodecString(Configuration configuration) {
boolean compress = configuration.getBoolean(FileOutputFormat.COMPRESS, false);
String codecType = configuration.get(FileOutputFormat.COMPRESS_TYPE, null);
if (compress && (codecType == null || !codecType.equals(CompressionType.NONE.toString()))) {
Class<?> codecClass = configuration.getClass(FileOutputFormat.COMPRESS_CODEC, DefaultCodec.class);
if (codecClass == null) {
return CODEC_NONE;
} else {
try {
return ((CompressionCodec) codecClass.newInstance()).getDefaultExtension().replace(".", "");
} catch (Exception exception) {
throw new RuntimeException("Could not determine codec", exception);
}
}
}
return CODEC_NONE;
}
MrUtil.java 文件源码
java
阅读 22
收藏 0
点赞 0
评论 0
项目:cloudera-framework
作者:
评论列表
文章目录