Class NativeLoader

java.lang.Object
org.drasyl.crypto.loader.NativeLoader

public class NativeLoader extends Object
This class helps to load native libraries, used with JNA.

Based on: native-utils

  • Field Details

  • Method Details

    • loadLibraryFromJar

      public static void loadLibraryFromJar(String path, Class clazz) throws IOException
      Loads library from current JAR archive

      The file is copied into system temporary directory and then loaded. The temporary file is deleted after exiting. Method uses String as filename because the pathname is "abstract", not system-dependent.

      Parameters:
      path - The path of file as absolute path (beginning with '/'), e.g. /package/File.ext
      Throws:
      IOException - If library could not be loaded
    • loadLibraryFromFileSystem

      public static void loadLibraryFromFileSystem(String path, Class clazz) throws IOException
      Loads library from current file system

      The file is copied into system temporary directory and then loaded. The temporary file is deleted after exiting. Method uses String as filename because the pathname is "abstract", not system-dependent.

      Parameters:
      path - The path of file as absolute path (beginning with '/'), e.g. /package/File.ext
      Throws:
      IOException - If library could not be loaded