Package electrostatic4j.snaploader
Class LibraryInfo
java.lang.Object
electrostatic4j.snaploader.LibraryInfo
Provides a platform-independent library placeholder with an adjustable baseName
baseName
grouping the common components among all platforms.
Understand the API vision:
The native dynamic API is composed of NativeDynamicLibrary which represents the
platform-dependent entity and the LibraryInfo which represents the abstract
platform-independent entity; the common components among them represent a backup
on the LibraryInfo side that the API will fall back to in case the platform directory
path is invalid.
- ------------------------------
- (2).Abstract: LibraryInfo (Grouping common components among all platforms; thus platform-independent).
- ------------------------------
- (1).Concrete: NativeDynamicLibrary (Grouping platform-dependent components).
- ------------------------------
where (1).(2) designates the runtime order.
-
Constructor Summary
ConstructorsConstructorDescriptionLibraryInfo(DirectoryPath jarPath, DirectoryPath directory, String baseName, DirectoryPath directoryPath) Instantiates a library info data structure pointing to a library in an external jar with jarPath.LibraryInfo(DirectoryPath directory, String baseName, DirectoryPath directoryPath) Instantiates a library info data structure pointing to a library in the classpath. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves the dynamic library basename.Retrieves the directory inside the compression used for locating the native dynamic library.Retrieves the extraction absolute directory.Retrieves the jar filesystem path, the jar is the compression used to locate the native dynamic library to be extracted and loaded byNativeBinaryLoader.voidsetBaseName(String baseName) Adjusts the library base name in a dynamic library name (lib-[basename]).voidsetDirectory(DirectoryPath directory) Sets the directory to the native dynamic library inside the jar compression, "null" to use the default directories specified for each variant byNativeBinaryLoader.voidsetExtractionDirectory(DirectoryPath directoryPath) Sets the extraction directory used for extracting the native dynamic library.voidsetJarPath(DirectoryPath jarPath) Sets the absolute path to the jar filesystem to locate the native dynamic library to be extracted and loaded, "null" to use the "classpath (the stock jar)"" to load the library filesystem.
-
Constructor Details
-
LibraryInfo
Instantiates a library info data structure pointing to a library in the classpath.- Parameters:
directory- the platform-independent directory inside the compression used for locating the native dynamic library, this is used as a backup directory path in case theNativeDynamicLibrary.getPlatformDirectory()is not valid.baseName- the library basename, for example, 'lib-basename.so' (not null).directoryPath- the extraction destination path,DirectoryPath.USER_DIRfor a user working directory extraction path, andDirectoryPath.USER_HOMEfor the user home (not null).
-
LibraryInfo
public LibraryInfo(DirectoryPath jarPath, DirectoryPath directory, String baseName, DirectoryPath directoryPath) Instantiates a library info data structure pointing to a library in an external jar with jarPath.- Parameters:
jarPath- a path to an external jar to locate the library inside,DirectoryPath.CLASS_PATHto assign the classpath routine to theFileLocatorAPI (not null).directory- the platform-independent directory inside the compression used for locating the native dynamic library, this is used as a backup directory path in case theNativeDynamicLibrary.getPlatformDirectory()is not valid.baseName- the library basename, for example, 'lib-basename.so' (not null).directoryPath- the extraction destination path,DirectoryPath.USER_DIRfor a user working directory extraction path, andDirectoryPath.USER_HOMEfor the user home (not null).
-
-
Method Details
-
getBaseName
Retrieves the dynamic library basename.- Returns:
- the library base-name in string (non-null)
-
getJarPath
Retrieves the jar filesystem path, the jar is the compression used to locate the native dynamic library to be extracted and loaded byNativeBinaryLoader.- Returns:
- the jar absolute filesystem path object.
-
getDirectory
Retrieves the directory inside the compression used for locating the native dynamic library.- Returns:
- the path to the dynamic library filesystem inside the compression.
-
getExtractionDirectory
Retrieves the extraction absolute directory.- Returns:
- the extraction destination path object.
-
setJarPath
Sets the absolute path to the jar filesystem to locate the native dynamic library to be extracted and loaded, "null" to use the "classpath (the stock jar)"" to load the library filesystem.- Parameters:
jarPath- the external jar path object to localize the compression, useDirectoryPath.CLASS_PATHto switch the file locator to the classpath routine.
-
setDirectory
Sets the directory to the native dynamic library inside the jar compression, "null" to use the default directories specified for each variant byNativeBinaryLoader.- Parameters:
directory- the location to the native dynamic library inside the jar compression.
-
setBaseName
Adjusts the library base name in a dynamic library name (lib-[basename]).- Parameters:
baseName- a new base-name to assign (non-null)
-
setExtractionDirectory
Sets the extraction directory used for extracting the native dynamic library.- Parameters:
directoryPath- the extraction directory path to which the native-located library will be extracted to.
-