com.lambdaworks.jni
Class JarLibraryLoader

java.lang.Object
  extended by com.lambdaworks.jni.JarLibraryLoader

public class JarLibraryLoader
extends Object

A native library loader that will extract and load a shared library contained in a jar. This loader will attempt to detect the platform (CPU architecture and OS) it is running on and load the appropriate shared library.

Author:
Will Glozer

Constructor Summary
JarLibraryLoader()
          Initialize a new instance that looks for shared libraries located in the same jar as this class and with a path starting with lib/.
JarLibraryLoader(CodeSource codeSource, String libraryPath)
          Initialize a new instance that looks for shared libraries located in the specified directory of the supplied code source.
 
Method Summary
 boolean load(String name, boolean verify)
          Load a shared library, and optionally verify the jar signatures.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarLibraryLoader

public JarLibraryLoader()
Initialize a new instance that looks for shared libraries located in the same jar as this class and with a path starting with lib/.


JarLibraryLoader

public JarLibraryLoader(CodeSource codeSource,
                        String libraryPath)
                 throws UnsupportedPlatformException
Initialize a new instance that looks for shared libraries located in the specified directory of the supplied code source.

Parameters:
codeSource - Code source containing shared libraries.
libraryPath - Path prefix of shared libraries.
Throws:
UnsupportedPlatformException - when the platform cannot be detected.
Method Detail

load

public boolean load(String name,
                    boolean verify)
Load a shared library, and optionally verify the jar signatures.

Parameters:
name - Name of the library to load.
verify - Verify the jar file if signed.
Returns:
true if the library was successfully loaded.


Copyright © 2011. All Rights Reserved.