Enum Class LoadingCriterion

java.lang.Object
java.lang.Enum<LoadingCriterion>
electrostatic4j.snaploader.LoadingCriterion
All Implemented Interfaces:
Serializable, Comparable<LoadingCriterion>, Constable

public enum LoadingCriterion extends Enum<LoadingCriterion>
Represents an extraction/loading criterion type.
  • Enum Constant Details

    • CLEAN_EXTRACTION

      public static final LoadingCriterion CLEAN_EXTRACTION
      Extracts the native binary to the extraction directory, ignoring its existence (the newly extracted binary will replace the current file).
    • INCREMENTAL_LOADING

      public static final LoadingCriterion INCREMENTAL_LOADING
      Extracts the native binary only if the current binary isn't present on the extraction directory.
    • SYSTEM_LOAD

      public static final LoadingCriterion SYSTEM_LOAD
      Commands to load a native dynamic library from the system directories.

      This criterion instructs the loader to search for the native library in predefined system locations, relying on the operating system's dynamic linker to resolve the library. The library must be pre-installed and accessible through standard system paths.

      System Library Search Paths

      The specific directories searched depend on the operating system:

      • Linux: Searches in:
        • Directories specified in LD_LIBRARY_PATH.
        • System-wide library directories:
          • /lib
          • /usr/lib
          • /usr/local/lib
          • Paths configured in /etc/ld.so.conf and /etc/ld.so.conf.d/.
      • Windows: Searches in:
        • Directories listed in the PATH environment variable.
        • System directories:
          • C:\Windows\System32 (for 64-bit DLLs)
          • C:\Windows\SysWOW64 (for 32-bit DLLs on 64-bit Windows)
          • Current working directory of the running process.
      • macOS: Searches in:
        • Directories specified in DYLD_LIBRARY_PATH.
        • System library locations:
          • /usr/lib
          • /usr/local/lib
          • /System/Library/Frameworks/ (for framework-based libraries).
      • Android: Searches in:
        • Application-specific native library directories:
          • /data/data/<package>/lib
          • Native library folders inside the APK:
            • /lib/armeabi-v7a/
            • /lib/arm64-v8a/
            • /lib/x86/
            • /lib/x86_64/
        • System native library locations:
          • /system/lib (for 32-bit libraries).
          • /system/lib64 (for 64-bit libraries).
      Usage Considerations

      This approach requires the library to be present on the system beforehand. If the library is missing, the loading process will fail with an UnsatisfiedLinkError. To ensure compatibility across different systems, consider providing a fallback mechanism to extract the library dynamically whenever required via NativeBinaryLoadingListener.onLoadingFailure(NativeBinaryLoader, CallingStackMetaData).

  • Method Details

    • values

      public static LoadingCriterion[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static LoadingCriterion valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null