Class Resource

java.lang.Object
org.apache.commons.discovery.Resource
Direct Known Subclasses:
ResourceClass

public class Resource extends 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.
  • Field Details

    • name

      protected final String name
    • resource

      protected final URL resource
    • loader

      protected final ClassLoader loader
  • Constructor Details

    • Resource

      public Resource(String resourceName, URL resource, ClassLoader loader)
      Create a new Resource instance.
      Parameters:
      resourceName - The resource name has to be located
      resource - The resource URL has to be located
      loader - The class loader used to locate the given resource
  • Method Details

    • getName

      public String getName()
      Get the value of resourceName.
      Returns:
      value of resourceName.
    • getResource

      public URL getResource()
      Get the value of URL.
      Returns:
      value of URL.
    • getResourceAsStream

      public InputStream getResourceAsStream()
      Get the value of URL.
      Returns:
      value of URL.
    • getClassLoader

      public ClassLoader getClassLoader()
      Get the value of loader.
      Returns:
      value of loader.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toArray

      public static Resource[] toArray(ResourceIterator iterator)
      Returns an array containing all of the elements in this ResourceIterator in proper sequence.
      Parameters:
      iterator - The ResourceIterator containing the
      Returns:
      An array containing the elements of the given ResourceIterator