public final class LibUtils extends Object
| Modifier and Type | Class and Description |
|---|---|
static class |
LibUtils.ARCHType
Enumeration of common CPU architectures.
|
static class |
LibUtils.OSType
Enumeration of common operating systems, independent of version
or architecture.
|
| Modifier and Type | Method and Description |
|---|---|
static void |
addLibraryPath(String pathToAdd)
Adds the specified path to the java library path
|
static LibUtils.ARCHType |
calculateArch()
Calculates the current ARCHType
|
static LibUtils.OSType |
calculateOS()
Calculates the current OSType
|
static String |
createLibName(String baseName)
Creates the name for the native library with the given base
name for the current operating system and architecture.
|
static String |
getArchName() |
static String |
getOsName()
Get the name of the os
for libary discovery on the classpath
|
static void |
loadJavaCpp(Class<?> clazz)
Prepend jni to the name for certain classes
|
static void |
loadJavaCppResource(String libName)
Load the library with the given name from a resource.
|
static void |
loadLibrary(String baseName)
Loads the specified library.
|
static void |
loadTempBinaryFile(Class<?> libName)
Load the library with the given name from a resource.
|
static void |
loadTempBinaryFile(String libName)
Load the library with the given name from a resource.
|
public static void loadJavaCpp(Class<?> clazz)
clazz - public static void loadLibrary(String baseName)
createLibName(String)
with the given argument. The method will attempt to load
the library as a as a resource (for usage within a JAR),
and, if this fails, using the usual System.loadLibrary
call.baseName - The base name of the libraryUnsatisfiedLinkError - if the native library
could not be loaded.public static void loadTempBinaryFile(String libName) throws Exception
public static void loadTempBinaryFile(Class<?> libName) throws Exception
public static void loadJavaCppResource(String libName) throws Throwable
libName - The library nameThrowable - If the library could not be loadedpublic static void addLibraryPath(String pathToAdd) throws Exception
pathToAdd - the path to addExceptionpublic static String getOsName()
public static String getArchName()
public static String createLibName(String baseName)
baseName - The base name of the librarypublic static LibUtils.OSType calculateOS()
public static LibUtils.ARCHType calculateArch()
Copyright © 2017. All rights reserved.