Class LibraryLoader
- java.lang.Object
-
- com.google.android.exoplayer2.util.LibraryLoader
-
public abstract class LibraryLoader extends Object
Configurable loader for native libraries.
-
-
Constructor Summary
Constructors Constructor Description LibraryLoader(String... libraries)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
isAvailable()
Returns whether the underlying libraries are available, loading them if necessary.protected abstract void
loadLibrary(String name)
Should be implemented to callSystem.loadLibrary(name)
.void
setLibraries(String... libraries)
Overrides the names of the libraries to load.
-
-
-
Constructor Detail
-
LibraryLoader
public LibraryLoader(String... libraries)
- Parameters:
libraries
- The names of the libraries to load.
-
-
Method Detail
-
setLibraries
public void setLibraries(String... libraries)
Overrides the names of the libraries to load. Must be called before any call toisAvailable()
.
-
isAvailable
public boolean isAvailable()
Returns whether the underlying libraries are available, loading them if necessary.
-
loadLibrary
protected abstract void loadLibrary(String name)
Should be implemented to callSystem.loadLibrary(name)
.It's necessary for each subclass to implement this method because
System.loadLibrary(String)
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:
name
- The name of the library to load.
-
-