Class NativeDynamicLibrary

java.lang.Object
electrostatic4j.snaploader.platform.NativeDynamicLibrary

public class NativeDynamicLibrary extends Object
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 Details

    • jarPath

      protected String jarPath
      The absolute path for the Jar file to extract and load the library from.
    • platformDirectory

      protected String platformDirectory
      The library path inside the compression (i.e., Jar file).
    • libraryFile

      protected String libraryFile
      A designator for the library name with the platform extension (basename + extension).
    • directoryPath

      protected DirectoryPath directoryPath
      A designator for the extraction directory of the native library.
    • platformPredicate

      protected PlatformPredicate platformPredicate
      The platform-specific predicate; that if evaluated as true, the respective native library object will be assigned by the NativeBinaryLoader to 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

      public NativeDynamicLibrary(String platformDirectory, 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.
      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

      public void initWithLibraryInfo(LibraryInfo libraryInfo)
      Initializes the native dynamic library with the library info.
      Parameters:
      libraryInfo - wraps abstract data representing the native library
    • getJarPath

      public String getJarPath()
      Retrieves the absolute path for the jar compression as specified by the LibraryInfo API.
      Returns:
      a string representing the absolute path to the jar compression containing the dynamic libraries
    • getPlatformDirectory

      public String 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

      public String getCompressedLibrary()
      Retrieves the library path within the jar compression.
      Returns:
      a string representing the library path within the jar compression
    • getExtractedLibrary

      public String 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

      public PlatformPredicate getPlatformPredicate()
      Retrieves the platform-specific predicate to test against.
      Returns:
      the predefined platform-specific predicate object.