|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.arakhne.vmutil.LibraryLoader
public class LibraryLoader
This class provides more generic means for loading dynamical libraries.
The library loader may be enabled or not. When library loader is enable, it is able to retreive and load native libraries. When it is disable, it ignore all the loading queries.
| Constructor Summary | |
|---|---|
LibraryLoader()
|
|
| Method Summary | |
|---|---|
static URL |
findLibraryURL(String libName)
Replies the URL for the specified library. |
static URL |
findLibraryURL(String path,
String libName)
Replies the URL for the specified library. |
(package private) static int |
getOperatingSystemArchitectureDataModel()
Replies the data model of the current operating system: 32 or 64 bits. |
static boolean |
isEnable()
Replies if this library loader is enable. |
static void |
load(File filename)
Loads a code file with the specified filename from the local file system as a dynamic library. |
static void |
load(String filename)
Loads a code file with the specified filename from the local file system as a dynamic library. |
static void |
load(URL filename)
Loads a code file with the specified filename from the local file system as a dynamic library. |
static void |
loadLibrary(String libname)
Loads the system library specified by the libname
argument. |
static void |
loadPlatformDependentLibrary(String libname)
Search and load the dynamic library which is fitting the current operating system (32 or 64bits operating system...). |
static void |
loadPlatformDependentLibrary(String path,
String libname)
Search and load the dynamic library which is fitting the current operating system (32 or 64bits operating system...). |
(package private) static void |
loadPlatformDependentLibrary(String libname,
String platform,
String... paths)
Search and load the dynamic library which is fitting the current operating system (32 or 64bits operating system...). |
static void |
setEnable(boolean enable)
Replies if this library loader is enable. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LibraryLoader()
| Method Detail |
|---|
public static boolean isEnable()
The library loader is able to load native libraries when it is enable. Otherwise it ignore all the loading queries.
true if the library loader is enable,
otherwise falsepublic static void setEnable(boolean enable)
The library loader is able to load native libraries when it is enable. Otherwise it ignore all the loading queries.
enable - is true to allow this loader
to retreive native libraries, or false to
ignore all the loading queries.public static void load(String filename)
The call LibraryLoader.load(name) is effectively equivalent
to the call:
System.load(name)
filename - is the file to load.
SecurityException - if a security manager exists and its
checkLink method doesn't allow
loading of the specified dynamic library
UnsatisfiedLinkError - if the file does not exist.
NullPointerException - if filename is
nullSystem.load(java.lang.String)public static void loadLibrary(String libname)
libname
argument. The manner in which a library name is mapped to the
actual system library is system dependent.
The call LibraryLoader.loadLibrary(name) is effectively
equivalent to the call
System.loadLibrary(name)
libname - the name of the library.
SecurityException - if a security manager exists and its
checkLink method doesn't allow
loading of the specified dynamic library
UnsatisfiedLinkError - if the library does not exist.
NullPointerException - if libname is
nullSystem.loadLibrary(java.lang.String)public static void load(File filename)
The call LibraryLoader.load(name) is effectively equivalent
to the call:
System.load(name.getAbsolutePath())
filename - is the file to load.
SecurityException - if a security manager exists and its
checkLink method doesn't allow
loading of the specified dynamic library
UnsatisfiedLinkError - if the file does not exist.
NullPointerException - if filename is
nullSystem.load(java.lang.String)public static URL findLibraryURL(String libName)
libName - is the name of the library
public static URL findLibraryURL(String path,
String libName)
The call LibraryLoader.findLibraryURL(path,name) is effectively equivalent
to the call:
getClassLoader().getResource(path+System.mapLibraryName(name))
path - is the resource's path where the library was located.libName - is the name of the library
public static void load(URL filename)
throws IOException
filename - is the file to load.
IOException
SecurityException - if a security manager exists and its
checkLink method doesn't allow
loading of the specified dynamic library
UnsatisfiedLinkError - if the file does not exist.
NullPointerException - if filename is
nullSystem.load(java.lang.String)
public static void loadPlatformDependentLibrary(String libname)
throws IOException
libname64.dll
on Windows® and liblibname64.so on Unix.
A 32 bits library is assumed to be named libname32.dll
on Windows® and liblibname32.so on Unix.
A library which could be ran either on 32 and 64 platforms is assumed
to be named libname.dll on Windows® and
liblibname.so on Unix.
libname - is the name of the library.
IOException
SecurityException - if a security manager exists and its
checkLink method doesn't allow
loading of the specified dynamic library
UnsatisfiedLinkError - if the file does not exist.
NullPointerException - if filename is
nullSystem.load(java.lang.String)static int getOperatingSystemArchitectureDataModel()
0 if
it could not be determined.
public static void loadPlatformDependentLibrary(String path,
String libname)
throws IOException
libname64.dll
on Windows® and liblibname64.so on Unix.
A 32 bits library is assumed to be named libname32.dll
on Windows® and liblibname32.so on Unix.
A library which could be ran either on 32 and 64 platforms is assumed
to be named libname.dll on Windows® and
liblibname.so on Unix.
path - is the resource's path where the library was located.libname - is the name of the library.
IOException
SecurityException - if a security manager exists and its
checkLink method doesn't allow
loading of the specified dynamic library
UnsatisfiedLinkError - if the file does not exist.
NullPointerException - if filename is
nullSystem.load(java.lang.String)
static void loadPlatformDependentLibrary(String libname,
String platform,
String... paths)
throws IOException
libname64.dll
on Windows® and liblibname64.so on Unix.
A 32 bits library is assumed to be named libname32.dll
on Windows® and liblibname32.so on Unix.
A library which could be ran either on 32 and 64 platforms is assumed
to be named libname.dll on Windows® and
liblibname.so on Unix.
libname - is the name of the library.platform - is the name of the current OS platform.paths - are the resource's paths where the library was located.
IOException
SecurityException - if a security manager exists and its
checkLink method doesn't allow
loading of the specified dynamic library
UnsatisfiedLinkError - if the file does not exist.
NullPointerException - if filename is
nullSystem.load(java.lang.String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||