Package org.conscrypt

Class NativeLibraryUtil


  • final class NativeLibraryUtil
    extends java.lang.Object
    A Utility to Call the System.load(String) or System.loadLibrary(String). Because the System.load(String) and System.loadLibrary(String) are both CallerSensitive, it will load the native library into its caller's ClassLoader. In OSGi environment, we need this helper to delegate the calling to System.load(String) and it should be as simple as possible. It will be injected into the native library's ClassLoader when it is undefined. And therefore, when the defined new helper is invoked, the native library would be loaded into the native library's ClassLoader, not the caller's ClassLoader.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NativeLibraryUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void loadLibrary​(java.lang.String libName, boolean absolute)
      Delegate the calling to System.load(String) or System.loadLibrary(String).
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NativeLibraryUtil

        private NativeLibraryUtil()
    • Method Detail

      • loadLibrary

        public static void loadLibrary​(java.lang.String libName,
                                       boolean absolute)
        Delegate the calling to System.load(String) or System.loadLibrary(String).
        Parameters:
        libName - - The native library path or name
        absolute - - Whether the native library will be loaded by path or by name