LibraryLoader
@UnstableApi
public abstract class LibraryLoader
Configurable loader for native libraries.
Summary
Public fields |
|
|---|---|
boolean |
Public constructors |
|---|
LibraryLoader(String[] libraries) |
Public methods |
|
|---|---|
synchronized boolean |
Returns whether the underlying libraries are available, loading them if necessary. |
synchronized void |
setLibraries(String[] libraries)Overrides the names of the libraries to load. |
Protected methods |
|
|---|---|
abstract void |
loadLibrary(String name)Should be implemented to call |
Public fields
Public constructors
LibraryLoader
public LibraryLoader(String[] libraries)
| Parameters | |
|---|---|
String[] libraries |
The names of the libraries to load. |
Public methods
isAvailable
synchronized public boolean isAvailable()
Returns whether the underlying libraries are available, loading them if necessary.
setLibraries
synchronized public void setLibraries(String[] libraries)
Overrides the names of the libraries to load. Must be called before any call to isAvailable.
Protected methods
loadLibrary
protected abstract void loadLibrary(String name)
Should be implemented to call System.loadLibrary(name).
It's necessary for each subclass to implement this method because loadLibrary uses reflection to obtain the calling class, which is then used to obtain the class loader to use when loading the native library. If this class were to implement the method directly, and if a subclass were to have a different class loader, then loading of the native library would fail.
| Parameters | |
|---|---|
String name |
The name of the library to load. |