Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » core » io » [javadoc | source]
org.springframework.core.io
abstract public class: AbstractResource [javadoc | source]
java.lang.Object
   org.springframework.core.io.AbstractResource

All Implemented Interfaces:
    Resource

Direct Known Subclasses:
    ByteArrayResource, InputStreamResource, FileSystemContextResource, ServletContextResource, PortletContextResource, ClassPathResource, FileSystemResource, BeanDefinitionResource, DescriptiveResource, UrlResource, ClassPathContextResource

Convenience base class for Resource implementations, pre-implementing typical behavior.

The "exists" method will check whether a File or InputStream can be opened; "isOpen" will always return false; "getURL" and "getFile" throw an exception; and "toString" will return the description.

Method from org.springframework.core.io.AbstractResource Summary:
createRelative,   equals,   exists,   getFile,   getFileForLastModifiedCheck,   getFilename,   getURI,   getURL,   hashCode,   isOpen,   isReadable,   lastModified,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.core.io.AbstractResource Detail:
 public Resource createRelative(String relativePath) throws IOException 
    This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource.
 public boolean equals(Object obj) 
    This implementation compares description strings.
 public boolean exists() 
    This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened. This will cover both directories and content resources.
 public File getFile() throws IOException 
    This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path.
 protected File getFileForLastModifiedCheck() throws IOException 
    Determine the File to use for timestamp checking.

    The default implementation delegates to #getFile() .

 public String getFilename() throws IllegalStateException 
    This implementation always throws IllegalStateException, assuming that the resource does not carry a filename.
 public URI getURI() throws IOException 
    This implementation builds a URI based on the URL returned by #getURL() .
 public URL getURL() throws IOException 
    This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL.
 public int hashCode() 
    This implementation returns the description's hash code.
 public boolean isOpen() 
    This implementation always returns false.
 public boolean isReadable() 
    This implementation always returns true.
 public long lastModified() throws IOException 
    This implementation checks the timestamp of the underlying File, if available.
 public String toString() 
    This implementation returns the description of this resource.