Java Code Examples for org.apache.hadoop.io.compress.zlib.ZlibFactory

Following code examples demonstrate how to use org.apache.hadoop.io.compress.zlib.ZlibFactory from hadoop. These examples are extracted from various highly rated open source projects. You can directly use these code snippets or view their entire linked source code. These snippets are extracted to provide contextual information about how to use this class in the real world. These samples also let you understand some good practices on how to use org.apache.hadoop.io.compress.zlib.ZlibFactory and various code implementation of this class.
Example 1
Project : hadoop Source File : TestHadoopNative.java View Source Code on GitHub

    @Test
    public void testNative()
    {
        HadoopNative.requireHadoopNative();

        assertTrue(NativeCodeLoader.isNativeCodeLoaded());
        assertTrue(NativeCodeLoader.buildSupportsSnappy());
        assertTrue(ZlibFactory.isNativeZlibLoaded(new Configuration()));
        assertTrue(Bzip2Factory.isNativeBzip2Loaded(new Configuration()));
    }
			
Example 2
Project : hadoop Source File : SnappyStudy.java View Source Code on GitHub

	public static void main(String[] args) {
		Configuration conf = new Configuration();
		
		System.out.println("buildSupportsSnappy:"+SnappyCodec.isNativeCodeLoaded());
		System.out.println("Bzip2Loaded:"+
				Bzip2Factory.isNativeBzip2Loaded(conf));
		System.out.println("ZlibLoaded:"+ZlibFactory.isNativeZlibLoaded(conf));
		System.out.println("ZlibLibrary:"+ZlibFactory.getLibraryName());
		
		System.out.println("NativeLibraryName:"+NativeCodeLoader.getLibraryName());
		
		
		NativeCodeLoader nativeloader = new NativeCodeLoader();
		
		Thread.currentThread().getContextClassLoader();
		
		SnappyCompressor snappyc = new SnappyCompressor();
		
		System.out.println(snappyc.isNativeCodeLoaded());
	}
			
Example 3
Project : hadoop Source File : TestNativeCodeLoader.java View Source Code on GitHub

  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());
    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.");
  }