public final class CANativeLibraryLoader extends Object
System.loadLibrary(String)
,
upon failure falls back to the base directory of the given class package or the jar the class
is in. This way, a native library is found, if it is located in the same directory as a particular jar, identified
by a specific class from that jar.Modifier and Type | Class and Description |
---|---|
static class |
CANativeLibraryLoader.LibFileFilter |
Modifier and Type | Method and Description |
---|---|
static String |
decodeURL(String s)
Decode % encodings in URLs.
|
static String |
findFile(String name,
Class<?> baseClass,
FileFilter filter)
Finds a file that is either in the classpath or in the same directory as a given class's jar.
|
static File |
getClasspathOrJarDir(Class<?> baseClass)
Return the classpath or the directory of the JAR of the given class.
|
static boolean |
loadLibrary()
Loads the CASampledSP library.
|
static void |
loadLibrary(String libName)
Loads a library.
|
static void |
loadLibrary(String libName,
Class<?> baseClass)
Loads a library.
|
public static boolean loadLibrary()
public static void loadLibrary(String libName)
libName
- name of the library, as described in System.loadLibrary(String)
);public static void loadLibrary(String libName, Class<?> baseClass)
libName
- name of the library, as described in System.loadLibrary(String)
);baseClass
- class that identifies the jarpublic static String findFile(String name, Class<?> baseClass, FileFilter filter) throws FileNotFoundException
name
- (partial) filename, only used for error reportingbaseClass
- base classfilter
- filter that determines whether a file is a matchFileNotFoundException
- if a matching file cannot be foundpublic static File getClasspathOrJarDir(Class<?> baseClass) throws UnsupportedEncodingException, MalformedURLException, FileNotFoundException
baseClass
- base classUnsupportedEncodingException
MalformedURLException
FileNotFoundException
public static String decodeURL(String s)
URLDecoder.decode(String, String)
method also converts +
to space
,
which is not what we want.s
- urlCopyright © 2011–2023 tagtraum industries incorporated. All rights reserved.