Class NativeDynamicLibrary
java.lang.Object
electrostatic4j.snaploader.platform.NativeDynamicLibrary
Represents a filesystem to a platform-specific binary inside
a compression with a predicate; if the predicate evaluates, the
library is loaded by the
NativeBinaryLoader.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DirectoryPathA designator for the extraction directory of the native library.protected StringThe absolute path for the Jar file to extract and load the library from.protected StringA designator for the library name with the platform extension (basename + extension).protected StringThe library path inside the compression (i.e., Jar file).protected PlatformPredicateThe platform-specific predicate; that if evaluated as true, the respective native library object will be assigned by theNativeBinaryLoaderto be extracted and loaded. -
Constructor Summary
ConstructorsConstructorDescriptionNativeDynamicLibrary(String platformDirectory, PlatformPredicate platformPredicate) Creates a Native dynamic library from a relative directory and a library filesystem.NativeDynamicLibrary(String platformDirectory, String libraryFile, PlatformPredicate platformPredicate) Creates a Native dynamic library from a relative directory and a library filesystem. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the library path within the jar compression.Retrieves the absolute path for the native library as supposed to be on the extraction directory.Retrieves the absolute path for the jar compression as specified by theLibraryInfoAPI.Retrieves the native library directory inside the jar compression.Retrieves the platform-specific predicate to test against.voidinitWithLibraryInfo(LibraryInfo libraryInfo) Initializes the native dynamic library with the library info.booleanTests whether the native library is extracted to the specified extraction directory.
-
Field Details
-
jarPath
The absolute path for the Jar file to extract and load the library from. -
platformDirectory
The library path inside the compression (i.e., Jar file). -
libraryFile
A designator for the library name with the platform extension (basename + extension). -
directoryPath
A designator for the extraction directory of the native library. -
platformPredicate
The platform-specific predicate; that if evaluated as true, the respective native library object will be assigned by theNativeBinaryLoaderto be extracted and loaded.
-
-
Constructor Details
-
NativeDynamicLibrary
public NativeDynamicLibrary(String platformDirectory, String libraryFile, PlatformPredicate platformPredicate) Creates a Native dynamic library from a relative directory and a library filesystem.- Parameters:
platformDirectory- the library directory inside the jar compression, "null" for the default library directory.libraryFile- the full library name including the platform extension which if assigned as "null", it will make the loader rely on the library info to obtain the full library name.platformPredicate- the predicate to test against; that if evaluated as true, the native library will be selected to be loaded by the native loader
-
NativeDynamicLibrary
Creates a Native dynamic library from a relative directory and a library filesystem.- Parameters:
platformDirectory- the library directory inside the jar compression, "null" for the default library directory.platformPredicate- the predicate to test against; that if evaluated as true, the native library will be selected to be loaded by the native loader
-
-
Method Details
-
initWithLibraryInfo
Initializes the native dynamic library with the library info.- Parameters:
libraryInfo- wraps abstract data representing the native library
-
getJarPath
Retrieves the absolute path for the jar compression as specified by theLibraryInfoAPI.- Returns:
- a string representing the absolute path to the jar compression containing the dynamic libraries
-
getPlatformDirectory
Retrieves the native library directory inside the jar compression.- Returns:
- a string representing the location of the native dynamic library to be loaded
-
getCompressedLibrary
Retrieves the library path within the jar compression.- Returns:
- a string representing the library path within the jar compression
-
getExtractedLibrary
Retrieves the absolute path for the native library as supposed to be on the extraction directory.- Returns:
- the absolute path composed of the extraction directory and the library name and system-specific extension
-
isExtracted
public boolean isExtracted()Tests whether the native library is extracted to the specified extraction directory.- Returns:
- true if the library has been extracted before, false otherwise
-
getPlatformPredicate
Retrieves the platform-specific predicate to test against.- Returns:
- the predefined platform-specific predicate object.
-