本文整理汇总了Java中org.apache.avro.file.CodecFactory.xzCodec方法的典型用法代码示例。如果您正苦于以下问题:Java CodecFactory.xzCodec方法的具体用法?Java CodecFactory.xzCodec怎么用?Java CodecFactory.xzCodec使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.avro.file.CodecFactory
的用法示例。
在下文中一共展示了CodecFactory.xzCodec方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCompressionCodec
import org.apache.avro.file.CodecFactory; //导入方法依赖的package包/类
private CodecFactory getCompressionCodec(Map<String, String> conf) {
if (getBoolean(conf, CONF_COMPRESS, false)) {
int deflateLevel = getInt(conf, CONF_DEFLATE_LEVEL, CodecFactory.DEFAULT_DEFLATE_LEVEL);
int xzLevel = getInt(conf, CONF_XZ_LEVEL, CodecFactory.DEFAULT_XZ_LEVEL);
String outputCodec = conf.get(CONF_COMPRESS_CODEC);
if (DataFileConstants.DEFLATE_CODEC.equals(outputCodec)) {
return CodecFactory.deflateCodec(deflateLevel);
} else if (DataFileConstants.XZ_CODEC.equals(outputCodec)) {
return CodecFactory.xzCodec(xzLevel);
} else {
return CodecFactory.fromString(outputCodec);
}
}
return CodecFactory.nullCodec();
}
示例2: getCompressionCodec
import org.apache.avro.file.CodecFactory; //导入方法依赖的package包/类
private CodecFactory getCompressionCodec(Map<String,String> conf) {
if (getBoolean(conf, CONF_COMPRESS, false)) {
int deflateLevel = getInt(conf, CONF_DEFLATE_LEVEL, CodecFactory.DEFAULT_DEFLATE_LEVEL);
int xzLevel = getInt(conf, CONF_XZ_LEVEL, CodecFactory.DEFAULT_XZ_LEVEL);
String outputCodec = conf.get(CONF_COMPRESS_CODEC);
if (DataFileConstants.DEFLATE_CODEC.equals(outputCodec)) {
return CodecFactory.deflateCodec(deflateLevel);
} else if (DataFileConstants.XZ_CODEC.equals(outputCodec)) {
return CodecFactory.xzCodec(xzLevel);
} else {
return CodecFactory.fromString(outputCodec);
}
}
return CodecFactory.nullCodec();
}
示例3: readExternal
import org.apache.avro.file.CodecFactory; //导入方法依赖的package包/类
@Override
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
final String codecStr = in.readUTF();
switch (codecStr) {
case NULL_CODEC:
case SNAPPY_CODEC:
case BZIP2_CODEC:
codecFactory = CodecFactory.fromString(codecStr);
return;
}
Matcher deflateMatcher = deflatePattern.matcher(codecStr);
if (deflateMatcher.find()) {
codecFactory = CodecFactory.deflateCodec(
Integer.parseInt(deflateMatcher.group("level")));
return;
}
Matcher xzMatcher = xzPattern.matcher(codecStr);
if (xzMatcher.find()) {
codecFactory = CodecFactory.xzCodec(
Integer.parseInt(xzMatcher.group("level")));
return;
}
throw new IllegalStateException(codecStr + " is not supported");
}
示例4: testXZCodecSerDeWithLevels
import org.apache.avro.file.CodecFactory; //导入方法依赖的package包/类
@Test
public void testXZCodecSerDeWithLevels() throws Exception {
for (int i = 0; i < 10; ++i) {
SerializableAvroCodecFactory codecFactory = new SerializableAvroCodecFactory(
CodecFactory.xzCodec(i));
SerializableAvroCodecFactory serdeC = SerializableUtils.clone(codecFactory);
assertEquals(CodecFactory.xzCodec(i).toString(), serdeC.getCodec().toString());
}
}
示例5: getCodec
import org.apache.avro.file.CodecFactory; //导入方法依赖的package包/类
protected CodecFactory getCodec() {
if (CODEC_DEFLATE.equalsIgnoreCase(codec)) {
return CodecFactory.deflateCodec(codecLevel);
} else if (CODEC_SNAPPY.equalsIgnoreCase(codec)) {
return CodecFactory.snappyCodec();
} else if (CODEC_BZIP2.equalsIgnoreCase(codec)) {
return CodecFactory.bzip2Codec();
} else if (CODEC_XY.equalsIgnoreCase(codec)) {
return CodecFactory.xzCodec(codecLevel);
} else {
return CodecFactory.nullCodec();
}
}
示例6: getCodecFactory
import org.apache.avro.file.CodecFactory; //导入方法依赖的package包/类
public CodecFactory getCodecFactory(Optional<Integer> compressionLevel) {
return CodecFactory.xzCodec(compressionLevel.or(CodecFactory.DEFAULT_XZ_LEVEL));
}