-
public final class LibraryLoaderA simple library class which helps with loading dynamic sodium library stored in the JAR archive. Works with JNA.
This class is thread-safe.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumLibraryLoader.ModeLibrary loading mode controls which libraries are attempted to be loaded (installed in the system or bundledin the Lazysodium JAR) and in which order.
-
Constructor Summary
Constructors Constructor Description LibraryLoader(List<Class> classesToRegister)
-
Method Summary
Modifier and Type Method Description voidloadLibrary(LibraryLoader.Mode mode, String systemFallBack)Loads the sodium library and registers the native methods of Sodium and SodiumJava using the specified loading mode.The library will be loaded at most once. voidloadSystemLibrary(String library)voidloadAbsolutePath(String absPath)static StringgetSodiumPathInResources()Returns the absolute path to sodium library inside JAR (beginning with '/'), e.g. -
-
Method Detail
-
loadLibrary
void loadLibrary(LibraryLoader.Mode mode, String systemFallBack)
Loads the sodium library and registers the native methods of Sodium and SodiumJava using the specified loading mode.The library will be loaded at most once.
- Parameters:
mode- controls which sodium library (installed in the system or bundled in the JAR)is loaded, and in which ordersystemFallBack- If loading directly fails then it will fall to the system fallback specified here
-
loadSystemLibrary
void loadSystemLibrary(String library)
-
loadAbsolutePath
void loadAbsolutePath(String absPath)
-
getSodiumPathInResources
static String getSodiumPathInResources()
Returns the absolute path to sodium library inside JAR (beginning with '/'), e.g. /linux/libsodium.so.
-
-
-
-