| java.lang.Object net.xoetrope.os.LibraryLoader
LibraryLoader | public class LibraryLoader (Code) | | Loads a native library file. The class can load the library by attempting to
have the Sytem class load the library from the library path. If this fails the
class can attempt to load the file by extracting it from the classpath,
including the Jar files on the classpath and then loading it with the full
file path. A temporary directory is used to temporarily extract the file.
If the file is loaded successfully the library name is placed in a hashtable
so that subsequent calls to load the library to not actually attempt to
load the library.
Copyright (c) Xoetrope Ltd., 2002-2004
$Revision: 1.8 $
License: see License.txt
|
BUF_LEN | final protected static int BUF_LEN(Code) | | |
extractFile | public String extractFile(ClassLoader classLoader, String resName, boolean overwrite) throws IOException(Code) | | Extract a file from a jar file to the specified location
Parameters: classLoader - the classloder to use to load the file Parameters: overwrite - true to overwrite any existing file Parameters: resName - the resource to extract the path to which the file is extracted throws: IOException - |
getExtractDirectory | protected String getExtractDirectory()(Code) | | Get the directory name to which the library will be extracted.
the path |
isUpToDate | protected boolean isUpToDate(URL url, File targetFile)(Code) | | Check that the temporary file exists and is up-to-date
Parameters: url - the URL of the source file Parameters: targetFile - the temporary file true if the file exists and is up-to-date |
load | public void load(ClassLoader classLoader, String resName, boolean checkLibPath, boolean overwrite)(Code) | | Load a native library
Parameters: classLoader - the classLoader used to find the library/resource Parameters: resName - the library/resource name Parameters: checkLibPath - true to check the system library path first before checking the resource path Parameters: overwrite - true to overwrite any existing temporary file, if false the the timestamp is checked to seeif the file needs to be extracted to the temporary directory |
|
|