Package org.rocksdb

Class NativeLibraryLoader


  • public class NativeLibraryLoader
    extends java.lang.Object
    This class is used to load the RocksDB shared library from within the jar. The shared library is extracted to a temp folder and loaded from there.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static NativeLibraryLoader getInstance()
      Get a reference to the NativeLibraryLoader
      void loadLibrary​(java.lang.String tmpDir)
      Firstly attempts to load the library from java.library.path, if that fails then it falls back to extracting the library from the classpath loadLibraryFromJar(java.lang.String)
      • Methods inherited from class java.lang.Object

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

      • getInstance

        public static NativeLibraryLoader getInstance()
        Get a reference to the NativeLibraryLoader
        Returns:
        The NativeLibraryLoader
      • loadLibrary

        public void loadLibrary​(java.lang.String tmpDir)
                         throws java.io.IOException
        Firstly attempts to load the library from java.library.path, if that fails then it falls back to extracting the library from the classpath loadLibraryFromJar(java.lang.String)
        Parameters:
        tmpDir - A temporary directory to use to copy the native library to when loading from the classpath. If null, or the empty string, we rely on Java's File.createTempFile(String, String) function to provide a temporary location. The temporary file will be registered for deletion on exit.
        Throws:
        java.io.IOException - if a filesystem operation fails.