gpt4 book ai didi

org.apache.hadoop.io.compress.zlib.ZlibFactory类的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 20:16:40 29 4
gpt4 key购买 nike

本文整理了Java中org.apache.hadoop.io.compress.zlib.ZlibFactory类的一些代码示例,展示了ZlibFactory类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZlibFactory类的具体详情如下:
包路径:org.apache.hadoop.io.compress.zlib.ZlibFactory
类名称:ZlibFactory

ZlibFactory介绍

[英]A collection of factories to create the right zlib/gzip compressor/decompressor instances.
[中]创建正确的zlib/gzip压缩程序/解压缩程序实例的工厂集合。

代码示例

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
 * Return the appropriate type of the zlib decompressor. 
 * 
 * @param conf configuration
 * @return the appropriate type of the zlib decompressor.
 */
public static Class<? extends Decompressor> 
getZlibDecompressorType(Configuration conf) {
 return (isNativeZlibLoaded(conf)) ? 
     ZlibDecompressor.class : BuiltInZlibInflater.class;
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

@Override
public Compressor createCompressor() {
 return ZlibFactory.getZlibCompressor(conf);
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

@Override
public Decompressor createDecompressor() {
 return ZlibFactory.getZlibDecompressor(conf);
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
 * Creates a new compressor, taking settings from the configuration.
 */
public ZlibCompressor(Configuration conf) {
 this(ZlibFactory.getCompressionLevel(conf),
    ZlibFactory.getCompressionStrategy(conf),
    CompressionHeader.DEFAULT_HEADER,
    DEFAULT_DIRECT_BUFFER_SIZE);
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

/**
 * Return the appropriate implementation of the zlib compressor. 
 * 
 * @param conf configuration
 * @return the appropriate implementation of the zlib compressor.
 */
public static Compressor getZlibCompressor(Configuration conf) {
 return (isNativeZlibLoaded(conf)) ? 
  new ZlibCompressor(conf) :
  new BuiltInZlibDeflater(ZlibFactory.getCompressionLevel(conf).compressionLevel());
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

zlibLoaded = ZlibFactory.isNativeZlibLoaded(conf);
if (zlibLoaded) {
 zlibLibraryName = ZlibFactory.getLibraryName();

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test
public void testZlibCompressorDecompressorSetDictionary() {
 Configuration conf = new Configuration();
 conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, true);
 if (ZlibFactory.isNativeZlibLoaded(conf)) {
  Compressor zlibCompressor = ZlibFactory.getZlibCompressor(conf);
  Decompressor zlibDecompressor = ZlibFactory.getZlibDecompressor(conf);
  checkSetDictionaryNullPointerException(zlibCompressor);
  checkSetDictionaryNullPointerException(zlibDecompressor);
  checkSetDictionaryArrayIndexOutOfBoundsException(zlibDecompressor);
  checkSetDictionaryArrayIndexOutOfBoundsException(zlibCompressor);
 } else {
  assertTrue("ZlibFactory is using native libs against request",
    ZlibFactory.isNativeZlibLoaded(conf));
 }
}

代码示例来源:origin: org.apache.hadoop/hadoop-common-test

conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, false);
assertFalse("ZlibFactory is using native libs against request",
  ZlibFactory.isNativeZlibLoaded(conf));
Decompressor zlibDecompressor = ZlibFactory.getZlibDecompressor(conf);
assertNotNull("zlibDecompressor is null!", zlibDecompressor);
assertTrue("ZlibFactory returned unexpected inflator",

代码示例来源:origin: org.apache.hadoop/hadoop-common-test

conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, useNative);
if (useNative) {
 if (!ZlibFactory.isNativeZlibLoaded(conf)) {
  LOG.warn("testGzipCodecWrite skipped: native libs not loaded");
  return;
   ZlibFactory.isNativeZlibLoaded(conf));
Compressor zlibCompressor = ZlibFactory.getZlibCompressor(conf);
assertNotNull("zlibCompressor is null!", zlibCompressor);
assertTrue("ZlibFactory returned unexpected deflator",

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test
public void testZlibFactory() {
 Configuration cfg = new Configuration();
 assertTrue("testZlibFactory compression level error !!!",
   CompressionLevel.DEFAULT_COMPRESSION == ZlibFactory
     .getCompressionLevel(cfg));
 assertTrue("testZlibFactory compression strategy error !!!",
   CompressionStrategy.DEFAULT_STRATEGY == ZlibFactory
     .getCompressionStrategy(cfg));
 ZlibFactory.setCompressionLevel(cfg, CompressionLevel.BEST_COMPRESSION);
 assertTrue("testZlibFactory compression strategy error !!!",
   CompressionLevel.BEST_COMPRESSION == ZlibFactory
     .getCompressionLevel(cfg));
 ZlibFactory.setCompressionStrategy(cfg, CompressionStrategy.FILTERED);
 assertTrue("testZlibFactory compression strategy error !!!",
   CompressionStrategy.FILTERED == ZlibFactory.getCompressionStrategy(cfg));
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

@Override
public Class<? extends Decompressor> getDecompressorType() {
 return ZlibFactory.getZlibDecompressorType(conf);
}

代码示例来源:origin: org.apache.hadoop/hadoop-common

@Override
public Class<? extends Compressor> getCompressorType() {
 return ZlibFactory.getZlibCompressorType(conf);
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test
 public void testNativeCodeLoaded() {
  if (requireTestJni() == false) {
   LOG.info("TestNativeCodeLoader: libhadoop.so testing is not required.");
   return;
  }
  if (!NativeCodeLoader.isNativeCodeLoaded()) {
   fail("TestNativeCodeLoader: libhadoop.so testing was required, but " +
     "libhadoop.so was not loaded.");
  }
  assertFalse(NativeCodeLoader.getLibraryName().isEmpty());
  // library names are depended on platform and build envs
  // so just check names are available
  assertFalse(ZlibFactory.getLibraryName().isEmpty());
  if (NativeCodeLoader.buildSupportsSnappy()) {
   assertFalse(SnappyCodec.getLibraryName().isEmpty());
  }
  if (NativeCodeLoader.buildSupportsOpenssl()) {
   assertFalse(OpensslCipher.getLibraryName().isEmpty());
  }
  assertFalse(Lz4Codec.getLibraryName().isEmpty());
  LOG.info("TestNativeCodeLoader: libhadoop.so is loaded.");
 }
}

代码示例来源:origin: ch.cern.hadoop/hadoop-common

@Test
public void testZlibCompressorDecompressorSetDictionary() {
 Configuration conf = new Configuration();
 conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, true);
 if (ZlibFactory.isNativeZlibLoaded(conf)) {
  Compressor zlibCompressor = ZlibFactory.getZlibCompressor(conf);
  Decompressor zlibDecompressor = ZlibFactory.getZlibDecompressor(conf);
  checkSetDictionaryNullPointerException(zlibCompressor);
  checkSetDictionaryNullPointerException(zlibDecompressor);
  checkSetDictionaryArrayIndexOutOfBoundsException(zlibDecompressor);
  checkSetDictionaryArrayIndexOutOfBoundsException(zlibCompressor);
 } else {
  assertTrue("ZlibFactory is using native libs against request",
    ZlibFactory.isNativeZlibLoaded(conf));
 }
}

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, false);
assertFalse("ZlibFactory is using native libs against request",
  ZlibFactory.isNativeZlibLoaded(conf));
Decompressor zlibDecompressor = ZlibFactory.getZlibDecompressor(conf);
assertNotNull("zlibDecompressor is null!", zlibDecompressor);
assertTrue("ZlibFactory returned unexpected inflator",

代码示例来源:origin: org.apache.hadoop/hadoop-common

public GzipZlibCompressor(Configuration conf) {
  super(ZlibFactory.getCompressionLevel(conf),
     ZlibFactory.getCompressionStrategy(conf),
     ZlibCompressor.CompressionHeader.GZIP_FORMAT,
     64 * 1024);
 }
}

代码示例来源:origin: io.hops/hadoop-common

/**
 * Return the appropriate implementation of the zlib compressor. 
 * 
 * @param conf configuration
 * @return the appropriate implementation of the zlib compressor.
 */
public static Compressor getZlibCompressor(Configuration conf) {
 return (isNativeZlibLoaded(conf)) ? 
  new ZlibCompressor(conf) :
  new BuiltInZlibDeflater(ZlibFactory.getCompressionLevel(conf).compressionLevel());
}

代码示例来源:origin: io.prestosql.hadoop/hadoop-apache

zlibLoaded = ZlibFactory.isNativeZlibLoaded(conf);
if (zlibLoaded) {
 zlibLibraryName = ZlibFactory.getLibraryName();

代码示例来源:origin: ch.cern.hadoop/hadoop-common

conf.setBoolean(CommonConfigurationKeys.IO_NATIVE_LIB_AVAILABLE_KEY, useNative);
if (useNative) {
 if (!ZlibFactory.isNativeZlibLoaded(conf)) {
  LOG.warn("testGzipCodecWrite skipped: native libs not loaded");
  return;
   ZlibFactory.isNativeZlibLoaded(conf));
Compressor zlibCompressor = ZlibFactory.getZlibCompressor(conf);
assertNotNull("zlibCompressor is null!", zlibCompressor);
assertTrue("ZlibFactory returned unexpected deflator",

代码示例来源:origin: com.github.jiayuhan-it/hadoop-common

@Test
public void testZlibFactory() {
 Configuration cfg = new Configuration();
 assertTrue("testZlibFactory compression level error !!!",
   CompressionLevel.DEFAULT_COMPRESSION == ZlibFactory
     .getCompressionLevel(cfg));
 assertTrue("testZlibFactory compression strategy error !!!",
   CompressionStrategy.DEFAULT_STRATEGY == ZlibFactory
     .getCompressionStrategy(cfg));
 ZlibFactory.setCompressionLevel(cfg, CompressionLevel.BEST_COMPRESSION);
 assertTrue("testZlibFactory compression strategy error !!!",
   CompressionLevel.BEST_COMPRESSION == ZlibFactory
     .getCompressionLevel(cfg));
 ZlibFactory.setCompressionStrategy(cfg, CompressionStrategy.FILTERED);
 assertTrue("testZlibFactory compression strategy error !!!",
   CompressionStrategy.FILTERED == ZlibFactory.getCompressionStrategy(cfg));
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com