com.lambdaworks.jni
Class JarLibraryLoader

java.lang.Object
  extended by com.lambdaworks.jni.JarLibraryLoader
All Implemented Interfaces:
LibraryLoader

public class JarLibraryLoader
extends Object
implements LibraryLoader

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. Given a library path and name this loader looks for a native library with path [libraryPath]/[arch]/[os]/lib[name].[ext]

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)
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.
Method Detail

load

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

Specified by:
load in interface LibraryLoader
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.