Package com.aparapi.natives.util
Class NativeUtils
java.lang.Object
com.aparapi.natives.util.NativeUtils
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).
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprivate
Private constructor - this class will never be instanced -
Method Summary
Modifier and TypeMethodDescriptionstatic void
loadLibraryFromJar
(String path, String libraryTargetFileName) Loads library from current JAR archive The file from JAR is copied into system temporary directory and then loaded.
-
Constructor Details
-
NativeUtils
private NativeUtils()Private constructor - this class will never be instanced
-
-
Method Details
-
loadLibraryFromJar
Loads library from current JAR archive The file from JAR is copied into system temporary directory and then loaded. The temporary file and folder are deleted after exiting. Method uses String as filename because the pathname is "abstract", not system-dependent.- Parameters:
path
- The path of file inside JAR as absolute path (beginning with '/'), e.g. /package/File.ext- Throws:
IOException
- If temporary file creation or read/write operation failsIllegalArgumentException
- If source file (param path) does not existIllegalArgumentException
- If the path is not absolute or if the filename is shorter than three characters (restriction of @see File#createTempFile(java.lang.String, java.lang.String)).
-