下面列出了org.apache.hadoop.io.SequenceFile.CompressionType#valueOf ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
/**
* Compression: based on compression codec and compression type (default
* value RECORD). If there is no codec, compression type is ignored, and
* NONE is used.
*
* @param context - container where compression codec and type are held
*/
private void getCompressionCodec(RequestContext context) {
String userCompressCodec = context.getOption("COMPRESSION_CODEC");
String userCompressType = context.getOption("COMPRESSION_TYPE");
String parsedCompressType = parseCompressionType(userCompressType);
compressionType = CompressionType.NONE;
codec = null;
if (userCompressCodec != null) {
codec = codecFactory.getCodec(userCompressCodec, configuration);
try {
compressionType = CompressionType.valueOf(parsedCompressType);
} catch (IllegalArgumentException e) {
throw new IllegalArgumentException(
String.format("Illegal value for compression type '%s'", parsedCompressType));
}
LOG.debug("Compression ON: compression codec: {}, compression type: {}",
userCompressCodec, compressionType);
}
}
/**
* Get the {@link CompressionType} for the output {@link SequenceFile}.
* @param conf the {@link JobConf}
* @return the {@link CompressionType} for the output {@link SequenceFile},
* defaulting to {@link CompressionType#RECORD}
*/
public static CompressionType getOutputCompressionType(JobConf conf) {
String val = conf.get(org.apache.hadoop.mapreduce.lib.output.
FileOutputFormat.COMPRESS_TYPE, CompressionType.RECORD.toString());
return CompressionType.valueOf(val);
}
/**
* Get the {@link CompressionType} for the output {@link SequenceFile}.
* @param job the {@link Job}
* @return the {@link CompressionType} for the output {@link SequenceFile},
* defaulting to {@link CompressionType#RECORD}
*/
public static CompressionType getOutputCompressionType(JobContext job) {
String val = job.getConfiguration().get(FileOutputFormat.COMPRESS_TYPE,
CompressionType.RECORD.toString());
return CompressionType.valueOf(val);
}
/**
* Get the {@link CompressionType} for the output {@link SequenceFile}.
* @param conf the {@link JobConf}
* @return the {@link CompressionType} for the output {@link SequenceFile},
* defaulting to {@link CompressionType#RECORD}
*/
public static CompressionType getOutputCompressionType(JobConf conf) {
String val = conf.get(org.apache.hadoop.mapreduce.lib.output.
FileOutputFormat.COMPRESS_TYPE, CompressionType.RECORD.toString());
return CompressionType.valueOf(val);
}
/**
* Get the {@link CompressionType} for the output {@link SequenceFile}.
* @param job the {@link Job}
* @return the {@link CompressionType} for the output {@link SequenceFile},
* defaulting to {@link CompressionType#RECORD}
*/
public static CompressionType getOutputCompressionType(JobContext job) {
String val = job.getConfiguration().get(FileOutputFormat.COMPRESS_TYPE,
CompressionType.RECORD.toString());
return CompressionType.valueOf(val);
}
/**
* Get the {@link CompressionType} for the output {@link SequenceFile}.
* @param conf the {@link JobConf}
* @return the {@link CompressionType} for the output {@link SequenceFile},
* defaulting to {@link CompressionType#RECORD}
*/
public static CompressionType getOutputCompressionType(JobConf conf) {
String val = conf.get("mapred.output.compression.type",
CompressionType.RECORD.toString());
return CompressionType.valueOf(val);
}
/**
* Get the {@link CompressionType} for the output {@link SequenceFile}.
* @param job the {@link Job}
* @return the {@link CompressionType} for the output {@link SequenceFile},
* defaulting to {@link CompressionType#RECORD}
*/
public static CompressionType getOutputCompressionType(JobContext job) {
String val = job.getConfiguration().get("mapred.output.compression.type",
CompressionType.RECORD.toString());
return CompressionType.valueOf(val);
}
/**
* Get the {@link CompressionType} for the output {@link SequenceFile}.
* @param conf the {@link JobConf}
* @return the {@link CompressionType} for the output {@link SequenceFile},
* defaulting to {@link CompressionType#RECORD}
*/
public static CompressionType getOutputCompressionType(JobConf conf) {
String val = conf.get("mapred.output.compression.type",
CompressionType.RECORD.toString());
return CompressionType.valueOf(val);
}
/**
* Get the {@link CompressionType} for the output {@link SequenceFile}.
* @param job the {@link Job}
* @return the {@link CompressionType} for the output {@link SequenceFile},
* defaulting to {@link CompressionType#RECORD}
*/
public static CompressionType getOutputCompressionType(JobContext job) {
String val = job.getConfiguration().get("mapred.output.compression.type",
CompressionType.RECORD.toString());
return CompressionType.valueOf(val);
}