接口 NativeUtil


public interface NativeUtil
A simple library class which helps with loading dynamic libraries stored in the JAR archive. These libraries usually contain implementation of some methods in native code (using JNI - Java Native Interface).
另请参阅:
http://adamheinrich.com/blog/2012/how-to-load-native-jni-library-from-jar, https://github.com/adamheinrich/native-utils
  • 字段详细资料

    • NATIVE_FOLDER_PATH_PREFIX

      @NotNull static final @NotNull String NATIVE_FOLDER_PATH_PREFIX
      另请参阅:
      常量字段值
    • TEM_DIR

      @NotNull static final @NotNull String TEM_DIR
    • isPosixCompliant

      static final boolean isPosixCompliant
  • 方法详细资料

    • loadLibraryFromJar

      static void loadLibraryFromJar(@NotNull @NotNull String fileName, @NotNull @NotNull Class<?> callerClass)
      Loads library from current JAR archive

      The file from JAR 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.

      参数:
      fileName - the native library name under /native/
      callerClass - the caller class used to call Class.getResourceAsStream(String)
      抛出:
      IllegalArgumentException - If source file (param path) does not exist
      IllegalArgumentException - If the path is not absolute or if the fileName is shorter than three characters (restriction of File.createTempFile(String, String)).
      UnsupportedOperationException - if UnsatisfiedLinkError is thrown.
    • isPosixCompliant

      static boolean isPosixCompliant()
    • createTempDirectory

      @NotNull static @NotNull File createTempDirectory()