Class JarLibraryLoader
java.lang.Object
com.lambdaworks.jni.JarLibraryLoader
- All Implemented Interfaces:
LibraryLoader
A native library loader that will extract and load a shared library contained in a jar.
This loader will attempt to detect the
platform (CPU architecture and OS)
it is running on and load the appropriate shared library.
Given a library path and name this loader looks for a native library with path
[libraryPath]/[arch]/[os]/lib[name].[ext]-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionInitialize a new instance that looks for shared libraries located in the same jar as this class and with a path starting withlib.JarLibraryLoader(CodeSource codeSource, String libraryPath) Initialize a new instance that looks for shared libraries located in the specified directory of the supplied code source. -
Method Summary
Modifier and TypeMethodDescriptionprivate static Fileextract(String name, InputStream is) Extract a jar entry to a temp file.libCandidates(Platform platform, String name) Generate a list of candidate libraries for the supplied library name and suitable for the current platform.booleanLoad a shared library, and optionally verify the jar signatures.
-
Field Details
-
codeSource
-
libraryPath
-
-
Constructor Details
-
JarLibraryLoader
public JarLibraryLoader()Initialize a new instance that looks for shared libraries located in the same jar as this class and with a path starting withlib. -
JarLibraryLoader
Initialize a new instance that looks for shared libraries located in the specified directory of the supplied code source.- Parameters:
codeSource- Code source containing shared libraries.libraryPath- Path prefix of shared libraries.
-
-
Method Details
-
load
Load a shared library, and optionally verify the jar signatures.- Specified by:
loadin interfaceLibraryLoader- Parameters:
name- Name of the library to load.verify- Verify the jar file if signed.- Returns:
- true if the library was successfully loaded.
-
extract
Extract a jar entry to a temp file.- Parameters:
name- Name prefix for temp file.is- Jar entry input stream.- Returns:
- A temporary file.
- Throws:
IOException- when an IO error occurs.
-
libCandidates
-