Package org.apache.commons.discovery
Class Resource
- java.lang.Object
-
- org.apache.commons.discovery.Resource
-
- Direct Known Subclasses:
ResourceClass
public class Resource extends java.lang.Object
'Resource' located by discovery. Naming of methods becomes a real pain ('getClass()') so I've patterned this after ClassLoader... I think it works well as it will give users a point-of-reference.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.ClassLoader
getClassLoader()
Get the value of loader.java.lang.String
getName()
Get the value of resourceName.java.net.URL
getResource()
Get the value of URL.java.io.InputStream
getResourceAsStream()
Get the value of URL.static Resource[]
toArray(ResourceIterator iterator)
Returns an array containing all of the elements in thisResourceIterator
in proper sequence.java.lang.String
toString()
-
-
-
Constructor Detail
-
Resource
public Resource(java.lang.String resourceName, java.net.URL resource, java.lang.ClassLoader loader)
Create a newResource
instance.- Parameters:
resourceName
- The resource name has to be locatedresource
- The resource URL has to be locatedloader
- The class loader used to locate the given resource
-
-
Method Detail
-
getName
public java.lang.String getName()
Get the value of resourceName.- Returns:
- value of resourceName.
-
getResource
public java.net.URL getResource()
Get the value of URL.- Returns:
- value of URL.
-
getResourceAsStream
public java.io.InputStream getResourceAsStream()
Get the value of URL.- Returns:
- value of URL.
-
getClassLoader
public java.lang.ClassLoader getClassLoader()
Get the value of loader.- Returns:
- value of loader.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toArray
public static Resource[] toArray(ResourceIterator iterator)
Returns an array containing all of the elements in thisResourceIterator
in proper sequence.- Parameters:
iterator
- TheResourceIterator
containing the- Returns:
- An array containing the elements of the given
ResourceIterator
-
-