public class NativeUtils extends java.lang.Object
| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
NATIVE_FOLDER_PATH_PREFIX  | 
| Modifier and Type | Method and Description | 
|---|---|
static java.io.File | 
copyToTempFromJar(java.lang.String path)  | 
static java.io.File | 
copyToTempFromJar(java.lang.String path,
                 java.lang.Class<?> loadClass)
copy file from current JAR archive to system temporary directory
 
 The file from JAR is copied into system temporary directory and then loaded. 
 | 
static java.io.File | 
getTemporaryDir()  | 
static void | 
loadFromJar(java.lang.String name)
从jar包中位置'/lib/os_prefix'加载指定名字的动态库 
os_prefix由 Platform.getNativeLibraryResourcePrefix()计算 | 
static void | 
loadLibraryFromJar(java.lang.String path)
从jar包中加载指定的动态库 
 | 
static void | 
loadLibraryFromJar(java.lang.String path,
                  java.lang.Class<?> loadClass)
Loads library from current JAR archive 
 | 
static void | 
loadLibraryFromResource(java.lang.String name,
                       java.lang.Class<?> loaderClass)
从资源中加载动态库 
 | 
public static final java.lang.String NATIVE_FOLDER_PATH_PREFIX
public static void loadLibraryFromJar(java.lang.String path, java.lang.Class<?> loadClass) throws java.io.IOException
java.io.IOExceptioncopyToTempFromJar(String, Class)public static java.io.File copyToTempFromJar(java.lang.String path, java.lang.Class<?> loadClass) throws java.io.IOException
path - The path of file inside JAR as absolute path (beginning with '/'), e.g. /package/File.extloadClass - class that provide ClassLoader to load library file by input stream,if null, current class instead.java.io.IOException - If temporary file creation or read/write operation failsjava.lang.IllegalArgumentException - If the path is not absolute or if the filename is shorter than three characters
 (restriction of File.createTempFile(java.lang.String, java.lang.String)).java.io.FileNotFoundException - If the file could not be found inside the JAR.public static java.io.File copyToTempFromJar(java.lang.String path) throws java.io.IOException
java.io.IOException#copyToTempFromJar(String, Class)}public static void loadLibraryFromJar(java.lang.String path) throws java.io.IOException
path - java.io.IOException#loadLibraryFromJar(String, Class)}public static void loadFromJar(java.lang.String name) throws java.io.IOException
Platform.getNativeLibraryResourcePrefix()计算name - 库名java.io.IOException#loadLibraryFromJar(String, Class)}public static java.io.File getTemporaryDir()
public static void loadLibraryFromResource(java.lang.String name, java.lang.Class<?> loaderClass) throws java.io.IOException
name - 动态库名,参见 System.loadLibrary(String)loaderClass - java.io.IOExceptionCopyright © 2019. All rights reserved.