org.opensaml.util.resource
Class ClasspathResource

java.lang.Object
  extended by org.opensaml.util.resource.AbstractFilteredResource
      extended by org.opensaml.util.resource.ClasspathResource
All Implemented Interfaces:
Resource

public class ClasspathResource
extends AbstractFilteredResource

Resource that represents a resource found on the classpath. Because object on the classpath are not meant to change during runtime the last modification is set to the time the ClasspathResource is created and is never changed.


Constructor Summary
ClasspathResource(String path)
          Constructor.
ClasspathResource(String path, ResourceFilter resourceFilter)
          Deprecated. use AbstractFilteredResource.setResourceFilter(ResourceFilter) instead
 
Method Summary
 boolean equals(Object o)
          
 boolean exists()
          Checks whether the resource exists.
 InputStream getInputStream()
          Gets the inputstream to the resource's data.
 org.joda.time.DateTime getLastModifiedTime()
          Gets the date and time the resource was last modified.
 String getLocation()
          Gets resource location information.
 int hashCode()
          
 String toString()
          
 
Methods inherited from class org.opensaml.util.resource.AbstractFilteredResource
applyFilter, getResourceFilter, setResourceFilter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClasspathResource

public ClasspathResource(String path)
                  throws ResourceException
Constructor.

Parameters:
path - the path to the file for this resource
Throws:
ResourceException - thrown if the resource path is null or empty or if the resource does not exist

ClasspathResource

public ClasspathResource(String path,
                         ResourceFilter resourceFilter)
                  throws ResourceException
Deprecated. use AbstractFilteredResource.setResourceFilter(ResourceFilter) instead

Constructor.

Parameters:
path - the path to the file for this resource
resourceFilter - filter to apply to this resource
Throws:
ResourceException - thrown if the resource path is null or empty or if the resource does not exist
Method Detail

exists

public boolean exists()
               throws ResourceException
Checks whether the resource exists.

Returns:
true if the resource exists, false if not
Throws:
ResourceException - thrown if there is a problem determining if the resource exists

getInputStream

public InputStream getInputStream()
                           throws ResourceException
Gets the inputstream to the resource's data.

Returns:
inputstream to the resource's data
Throws:
ResourceException - thrown if an input stream can not be created for the resource

getLastModifiedTime

public org.joda.time.DateTime getLastModifiedTime()
                                           throws ResourceException
Gets the date and time the resource was last modified.

Returns:
date and time the resource was last modified
Throws:
ResourceException - thrown if the last modified time can not be determined

getLocation

public String getLocation()
Gets resource location information. Examples might be filesystem path, URL, etc.

Returns:
resource location information

toString

public String toString()

Overrides:
toString in class Object

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object o)

Overrides:
equals in class Object


Copyright © 2006-2013 Internet2. All Rights Reserved.