public abstract class AbstractFileResolvingResource extends AbstractResource
UrlResource or ClassPathResource.
Detects the "file" protocol as well as the JBoss "vfs" protocol in URLs, resolving file system references accordingly.
| Constructor and Description |
|---|
AbstractFileResolvingResource() |
| Modifier and Type | Method and Description |
|---|---|
long |
contentLength()
This implementation reads the entire InputStream to calculate the
content length.
|
boolean |
exists()
This implementation checks whether a File can be opened,
falling back to whether an InputStream can be opened.
|
File |
getFile()
This implementation returns a File reference for the underlying class path
resource, provided that it refers to a file in the file system.
|
protected File |
getFile(URI uri)
This implementation returns a File reference for the underlying class path
resource, provided that it refers to a file in the file system.
|
protected File |
getFileForLastModifiedCheck()
This implementation determines the underlying File
(or jar file, in case of a resource in a jar/zip).
|
boolean |
isReadable()
This implementation always returns
true. |
long |
lastModified()
This implementation checks the timestamp of the underlying File,
if available.
|
createRelative, equals, getFilename, getURI, getURL, hashCode, isOpen, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitgetDescriptiongetInputStreampublic File getFile() throws IOException
getFile in interface ResourcegetFile in class AbstractResourceIOException - if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file systemResourceUtils.getFile(java.net.URL, String)protected File getFileForLastModifiedCheck() throws IOException
getFileForLastModifiedCheck in class AbstractResourcenull)IOException - if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file systemprotected File getFile(URI uri) throws IOException
IOExceptionResourceUtils.getFile(java.net.URI, String)public boolean exists()
AbstractResourceexists in interface Resourceexists in class AbstractResourcepublic boolean isReadable()
AbstractResourcetrue.isReadable in interface ResourceisReadable in class AbstractResourceInputStreamSource.getInputStream()public long contentLength()
throws IOException
AbstractResourcecontentLength in interface ResourcecontentLength in class AbstractResourceIOException - if the resource cannot be resolved
(in the file system or as some other known physical resource type)InputStreamSource.getInputStream()public long lastModified()
throws IOException
AbstractResourcelastModified in interface ResourcelastModified in class AbstractResourceIOException - if the resource cannot be resolved
(in the file system or as some other known physical resource type)AbstractResource.getFileForLastModifiedCheck()