public class ClassLocator extends Object implements XMLResourcesLocator
It is important to use this locator if you want to load something in other jar files.
Since this locator is used frequently, Locators.getDefault()
is provided to return an instance of this class,
XMLResourcesLocator.Resource| Constructor and Description |
|---|
ClassLocator() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object o) |
List<XMLResourcesLocator.Resource> |
getDependentXMLResources(String name,
String elName,
String elDepends)
Returns a list of resources (
XMLResourcesLocator.Resource) after resolving
the dependence. |
String |
getDirectory()
Always returns null.
|
URL |
getResource(String name)
Finds the resource with the given name.
|
InputStream |
getResourceAsStream(String name)
Returns an input stream for reading the specified resource.
|
Enumeration<URL> |
getResources(String name)
Returns an enumeration of resources.
|
int |
hashCode() |
public Enumeration<URL> getResources(String name) throws IOException
XMLResourcesLocatorXMLResourcesLocator.getDependentXMLResources(java.lang.String, java.lang.String, java.lang.String), it doesn't resolve the dependence
among the resources.getResources in interface XMLResourcesLocatorname - the resource name, such as "metainfo/config.xml".IOExceptionpublic List<XMLResourcesLocator.Resource> getDependentXMLResources(String name, String elName, String elDepends) throws IOException
XMLResourcesLocatorXMLResourcesLocator.Resource) after resolving
the dependence.
The resource is returned in the format of XMLResourcesLocator.Resource
To resolve the dependence, it assumes each resource has two element whose name is identified by elName and elDepends. The elName element specifies the unique name of each resource. The elDepends element specifies a list of names of resources that this resource depends on. If not found, it assumes it could be loaded first.
getDependentXMLResources in interface XMLResourcesLocatorname - the resource name, such as "metainfo/config.xml".elName - the element used to specify the name.elDepends - the element used to specify the dependence.XMLResourcesLocator.Resource of the specified name.IOExceptionpublic String getDirectory()
getDirectory in interface Locatorpublic URL getResource(String name)
LocatorgetResource in interface Locatorpublic InputStream getResourceAsStream(String name)
LocatorgetResourceAsStream in interface LocatorCopyright © 2018. All rights reserved.