Class LibraryUtils
java.lang.Object
io.github.givimad.whisperjni.internal.LibraryUtils
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidextractLibraryFromJar(String path, String filename, WhisperJNI.LibraryLogger logger) Loads library from current JAR archive The file from JAR is copied into system temporary directory and then loaded.static voidloadLibrary(WhisperJNI.LoadOptions options) Register the native library, should be called at first.
-
Method Details
-
extractLibraryFromJar
public static void extractLibraryFromJar(String path, String filename, WhisperJNI.LibraryLogger logger) throws IOException 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.- 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 ofFile.createTempFile(java.lang.String, java.lang.String)).FileNotFoundException- If the file could not be found inside the JAR.
-
loadLibrary
Register the native library, should be called at first.- Throws:
IOException- when unable to load the native library
-