public class ResourceLoader extends ClassLoader
addResource(java.lang.String, java.net.URL)
,
addResources(java.lang.String, java.net.URL[])
Constructor and Description |
---|
ResourceLoader(ClassLoader delegate)
Creates a new
ResourceLoader instance taking a classloader
classloading is delegated to. |
Modifier and Type | Method and Description |
---|---|
void |
addResource(String name,
URL resource)
Adds a resource to the instance.
|
void |
addResources(String name,
URL[] resources)
Adds an array of resources to the instance.
|
protected Class |
findClass(String name) |
protected URL |
findResource(String name)
Finds the resource with the given name by searching the instance for any
resources first, falling back to the classloader classloading is
delegated to.
|
protected Enumeration |
findResources(String name)
Returns an enumeration of
{@code URL} objects
representing all the resources with the given name by searching the
instance for any resources first, falling back to the classloader
classloading is delegated to. |
clearAssertionStatus, defineClass, defineClass, defineClass, defineClass, definePackage, findLibrary, findLoadedClass, findSystemClass, getClassLoadingLock, getPackage, getPackages, getParent, getResource, getResourceAsStream, getResources, getSystemClassLoader, getSystemResource, getSystemResourceAsStream, getSystemResources, loadClass, loadClass, registerAsParallelCapable, resolveClass, setClassAssertionStatus, setDefaultAssertionStatus, setPackageAssertionStatus, setSigners
public ResourceLoader(ClassLoader delegate)
ResourceLoader
instance taking a classloader
classloading is delegated to.delegate
- classloader classloading is delegated to.public void addResource(String name, URL resource)
name
- the name of the resource to add.resource
- the resource to add to the instance.NullPointerException
- if name
or resource
is
null
.public void addResources(String name, URL[] resources)
name
- the name of the resources to add.resources
- the resources to add to the instance.NullPointerException
- if name
or resources
is
null
.protected Class findClass(String name) throws ClassNotFoundException
findClass
in class ClassLoader
ClassNotFoundException
protected URL findResource(String name)
findResource
in class ClassLoader
name
- the name of the resource.URL
object for reading the resource, or null
if the resource could not be found.protected Enumeration findResources(String name) throws IOException
{@code URL}
objects
representing all the resources with the given name by searching the
instance for any resources first, falling back to the classloader
classloading is delegated to.findResources
in class ClassLoader
name
- the resource name{@code URL}
objects for
the resources.IOException
- if searching fails.Copyright © 2005-2012 jDTAUS. All Rights Reserved.