public class ClassLocator extends java.lang.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(java.lang.Object o) |
java.util.List<XMLResourcesLocator.Resource> |
getDependentXMLResources(java.lang.String name,
java.lang.String elName,
java.lang.String elDepends)
Returns a list of resources (
XMLResourcesLocator.Resource ) after resolving
the dependence. |
java.lang.String |
getDirectory()
Always returns null.
|
java.net.URL |
getResource(java.lang.String name)
Finds the resource with the given name.
|
java.io.InputStream |
getResourceAsStream(java.lang.String name)
Returns an input stream for reading the specified resource.
|
java.util.Enumeration<java.net.URL> |
getResources(java.lang.String name)
Returns an enumeration of resources.
|
int |
hashCode() |
public java.util.Enumeration<java.net.URL> getResources(java.lang.String name) throws java.io.IOException
XMLResourcesLocator
XMLResourcesLocator.getDependentXMLResources(java.lang.String, java.lang.String, java.lang.String)
, it doesn't resolve the dependence
among the resources.getResources
in interface XMLResourcesLocator
name
- the resource name, such as "metainfo/config.xml".java.io.IOException
public java.util.List<XMLResourcesLocator.Resource> getDependentXMLResources(java.lang.String name, java.lang.String elName, java.lang.String elDepends) throws java.io.IOException
XMLResourcesLocator
XMLResourcesLocator.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 XMLResourcesLocator
name
- 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.java.io.IOException
public java.lang.String getDirectory()
getDirectory
in interface Locator
public java.net.URL getResource(java.lang.String name)
Locator
getResource
in interface Locator
public java.io.InputStream getResourceAsStream(java.lang.String name)
Locator
getResourceAsStream
in interface Locator
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
Copyright © 2005-2021 Potix Corporation. All Rights Reserved.