# Print output for @column tags ?>
public
final
class
DelegateLastClassLoader
extends PathClassLoader
java.lang.Object | ||||
↳ | java.lang.ClassLoader | |||
↳ | dalvik.system.BaseDexClassLoader | |||
↳ | dalvik.system.PathClassLoader | |||
↳ | dalvik.system.DelegateLastClassLoader |
A ClassLoader
implementation that implements a delegate last lookup policy.
For every class or resource this loader is requested to load, the following lookup order
is employed:
dex
files associated with this classloaders's
dexPath
is searched.parent
.Public constructors | |
---|---|
DelegateLastClassLoader(String dexPath, ClassLoader parent)
Equivalent to calling |
|
DelegateLastClassLoader(String dexPath, String librarySearchPath, ClassLoader parent)
Equivalent to calling |
|
DelegateLastClassLoader(String dexPath, String librarySearchPath, ClassLoader parent, boolean delegateResourceLoading)
Creates a |
Public methods | |
---|---|
URL
|
getResource(String name)
Finds the resource with the given name. |
Enumeration<URL>
|
getResources(String name)
Finds all the resources with the given name. |
Protected methods | |
---|---|
Class<?>
|
loadClass(String name, boolean resolve)
Loads the class with the specified binary name. |
Inherited methods | |
---|---|
public DelegateLastClassLoader (String dexPath, ClassLoader parent)
Equivalent to calling DelegateLastClassLoader(java.lang.String, java.lang.String, java.lang.ClassLoader, boolean)
with librarySearchPath = null, delegateResourceLoading = true
.
Parameters | |
---|---|
dexPath |
String |
parent |
ClassLoader |
public DelegateLastClassLoader (String dexPath, String librarySearchPath, ClassLoader parent)
Equivalent to calling DelegateLastClassLoader(java.lang.String, java.lang.String, java.lang.ClassLoader, boolean)
with delegateResourceLoading = true
.
Parameters | |
---|---|
dexPath |
String |
librarySearchPath |
String |
parent |
ClassLoader |
public DelegateLastClassLoader (String dexPath, String librarySearchPath, ClassLoader parent, boolean delegateResourceLoading)
Creates a DelegateLastClassLoader
that operates on a given dexPath
and a librarySearchPath
.
The dexPath
should consist of one or more of the following, separated by
File.pathSeparator
, which is ":"
on Android.
PathClassLoader
, this classloader will attempt to locate classes
(or resources) using the following lookup order.
dex
files contained in dexPath
is searched./li>
parent
.parent
is always searched first.
librarySearchPath
specifies one more directories containing native library files,
separated by File.pathSeparator
.
Parameters | |
---|---|
dexPath |
String : the list of jar/apk files containing classes and resources, delimited by
File.pathSeparator , which defaults to ":" on Android. |
librarySearchPath |
String : the list of directories containing native libraries, delimited
by File.pathSeparator ; may be null . |
parent |
ClassLoader : the parent class loader. May be null for the boot classloader. |
delegateResourceLoading |
boolean : whether to delegate resource loading to the parent if
the resource is not found. This does not affect class
loading delegation. |
public URL getResource (String name)
Finds the resource with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.
The name of a resource is a '/'-separated path name that identifies the resource.
This method will first search the parent class loader for the
resource; if the parent is null the path of the class loader
built-in to the virtual machine is searched. That failing, this method
will invoke findResource(java.lang.String)
to find the resource.
Parameters | |
---|---|
name |
String : The resource name |
Returns | |
---|---|
URL |
A URL object for reading the resource, or null if the resource could not be found or the invoker doesn't have adequate privileges to get the resource. |
public Enumeration<URL> getResources (String name)
Finds all the resources with the given name. A resource is some data (images, audio, text, etc) that can be accessed by class code in a way that is independent of the location of the code.
The name of a resource is a /-separated path name that identifies the resource.
The search order is described in the documentation for getResource(java.lang.String)
.
Parameters | |
---|---|
name |
String : The resource name |
Returns | |
---|---|
Enumeration<URL> |
An enumeration of URL objects for
the resource. If no resources could be found, the enumeration
will be empty. Resources that the class loader doesn't have
access to will not be in the enumeration. |
Throws | |
---|---|
IOException |
protected Class<?> loadClass (String name, boolean resolve)
Loads the class with the specified binary name. The default implementation of this method searches for classes in the following order:
Invoke findLoadedClass(java.lang.String)
to check if the class
has already been loaded.
Invoke the loadClass
method
on the parent class loader. If the parent is null the class
loader built-in to the virtual machine is used, instead.
Invoke the findClass(java.lang.String)
method to find the
class.
If the class was found using the above steps, and the
resolve flag is true, this method will then invoke the resolveClass(java.lang.Class)
method on the resulting Class object.
Subclasses of ClassLoader are encouraged to override findClass(java.lang.String)
, rather than this method.
Parameters | |
---|---|
name |
String : The binary name of the class |
resolve |
boolean : If true then resolve the class |
Returns | |
---|---|
Class<?> |
The resulting Class object |
Throws | |
---|---|
ClassNotFoundException |