|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.smardec.j2native.Library
Library
class is Java representation of the native library. This class is used to
load native library and locate it's functions. There is two types of libraries: first - is part of
the J2Native system, and must be loaded at the very begining, second - all other libraries.
Function
,
LibraryLoader
Field Summary | |
static Library |
FAKE_LIBRARY
|
static java.lang.String |
LIBRARY_ENFORCE_KEY
This is a key to search through system properties. |
Constructor Summary | |
Library(java.lang.String name)
Library constructor. |
Method Summary | |
static void |
ensureNativeCodeLoaded()
Check if native part of J2Native is loaded, and loads it if needed. |
Function |
getFunction(java.lang.String functionName)
Locate and returns |
static LibraryLoader |
getLibraryLoader()
Returns default LibraryLoader . |
java.lang.String |
getName()
Returns library name. |
boolean |
isLoaded()
Returns if library loaded. |
void |
load()
Loads library. |
void |
load(java.io.File directory)
Loads library from specified directory. |
void |
load(LibraryLoader loader)
Loads library using specified LibraryLoader . |
static void |
loadNativeCode()
Loads J2Native library, that is native part of the wrapper system. |
static void |
loadNativeCode(LibraryLoader loader)
Loads J2Native library, that is native part of the wrapper system. |
static void |
loadNativeCode(LibraryLoader loader,
java.lang.String nativeCodePath)
Loads J2Native library, that is native part of the wrapper system. |
static void |
loadNativeCode(java.lang.String nativeCodePath)
Loads J2Native library, that is native part of the wrapper system. |
static void |
setLibraryLoader(LibraryLoader libraryLoader)
Sets default LibraryLoader . |
void |
unload()
Unloads library and frees resources used by library. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String LIBRARY_ENFORCE_KEY
System.getProperty(LIBRARY_ENFORCE_KEY)
is null
or something different than true
then
no library searching will be performed. Underlie system is responsible for library location.
public static Library FAKE_LIBRARY
Constructor Detail |
public Library(java.lang.String name)
Library
constructor.
name
- filename of the libraryMethod Detail |
public static void loadNativeCode(LibraryLoader loader, java.lang.String nativeCodePath) throws java.lang.SecurityException
loader
- LibraryLoader
that will load librarynativeCodePath
- path to the library
java.lang.SecurityException
- if something goes wrongpublic static void loadNativeCode(LibraryLoader loader) throws java.lang.SecurityException, java.lang.UnsatisfiedLinkError
loader
- LibraryLoader
that will load library
java.lang.SecurityException
java.lang.UnsatisfiedLinkError
public static void loadNativeCode(java.lang.String nativeCodePath) throws java.lang.SecurityException, java.lang.UnsatisfiedLinkError
nativeCodePath
- path to the library
java.lang.SecurityException
java.lang.UnsatisfiedLinkError
public static void loadNativeCode() throws java.lang.SecurityException, java.lang.UnsatisfiedLinkError
java.lang.SecurityException
java.lang.UnsatisfiedLinkError
public static void ensureNativeCodeLoaded()
public void load() throws LibraryNotFoundException
LibraryNotFoundException
- if no library found in path.public void load(java.io.File directory) throws LibraryNotFoundException
directory
- directory from which library will be loaded
LibraryNotFoundException
- if no such library found in specified directorypublic void load(LibraryLoader loader) throws LibraryNotFoundException
LibraryLoader
.
loader
- LibraryLoader
used to load library
LibraryNotFoundException
- if no such library found in pathpublic void unload()
public boolean isLoaded()
public java.lang.String getName()
public Function getFunction(java.lang.String functionName) throws FunctionNotFoundException
functionName
- name of the function
FunctionNotFoundException
- if no such function found in this librarypublic static LibraryLoader getLibraryLoader()
LibraryLoader
.
LibraryLoader
public static void setLibraryLoader(LibraryLoader libraryLoader)
LibraryLoader
.
libraryLoader
- default loader
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |