public final class LibUtils
extends java.lang.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(java.lang.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 java.lang.String |
createLibName(java.lang.String baseName)
Creates the name for the native library with the given base
name for the current operating system and architecture.
|
static java.lang.String |
getArchName() |
static java.lang.String |
getOsName()
Get the name of the os
for libary discovery on the classpath
|
static void |
loadJavaCpp(java.lang.Class<?> clazz)
Prepend jni to the name for certain classes
|
static void |
loadJavaCppResource(java.lang.String libName)
Load the library with the given name from a resource.
|
static void |
loadLibrary(java.lang.String baseName)
Loads the specified library.
|
static void |
loadTempBinaryFile(java.lang.Class<?> libName)
Load the library with the given name from a resource.
|
static void |
loadTempBinaryFile(java.lang.String libName)
Load the library with the given name from a resource.
|
public static void loadJavaCpp(java.lang.Class<?> clazz)
clazz - public static void loadLibrary(java.lang.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 libraryjava.lang.UnsatisfiedLinkError - if the native library
could not be loaded.public static void loadTempBinaryFile(java.lang.String libName)
throws java.lang.Exception
libName - The library namejava.lang.Throwable - If the library could not be loadedjava.lang.Exceptionpublic static void loadTempBinaryFile(java.lang.Class<?> libName)
throws java.lang.Exception
libName - The library namejava.lang.Throwable - If the library could not be loadedjava.lang.Exceptionpublic static void loadJavaCppResource(java.lang.String libName)
throws java.lang.Throwable
libName - The library namejava.lang.Throwable - If the library could not be loadedpublic static void addLibraryPath(java.lang.String pathToAdd)
throws java.lang.Exception
pathToAdd - the path to addjava.lang.Exceptionpublic static java.lang.String getOsName()
public static java.lang.String getArchName()
public static java.lang.String createLibName(java.lang.String baseName)
baseName - The base name of the librarypublic static LibUtils.OSType calculateOS()
public static LibUtils.ARCHType calculateArch()
Copyright © 2018. All rights reserved.