Package com.pi4j.util
Class NativeLibraryLoader
- java.lang.Object
-
- com.pi4j.util.NativeLibraryLoader
-
public class NativeLibraryLoader extends Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
load(String fileName, String libName)
static void
loadLibraryFromClasspath(String path)
Loads library from classpath
-
-
-
Method Detail
-
loadLibraryFromClasspath
public static void loadLibraryFromClasspath(String path) throws IOException
Loads library from classpathThe file from classpath 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 file path in classpath as an absolute path, e.g. /package/File.ext (could be inside jar)- 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 ofFiles.createTempFile(java.lang.String, java.lang.String, java.nio.file.attribute.FileAttribute...)
).
-
-