public abstract class AbstractFileResolvingResource extends java.lang.Object implements Resource
org.springframework.core.io.UrlResource or org.springframework.core.io.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()
Determine the content length for this resource.
|
boolean |
exists()
Return whether this resource actually exists in physical form.
|
java.io.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 java.io.File |
getFile(java.net.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 java.io.File |
getFileForLastModifiedCheck()
This implementation determines the underlying File
(or jar file, in case of a resource in a jar/zip).
|
boolean |
isReadable()
Return whether the contents of this resource can be read,
e.g.
|
long |
lastModified()
Determine the last-modified timestamp for this resource.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcreateRelative, getDescription, getFilename, getInputStream, getURI, getURLpublic java.io.File getFile()
throws java.io.IOException
protected java.io.File getFileForLastModifiedCheck()
throws java.io.IOException
java.io.IOExceptionprotected java.io.File getFile(java.net.URI uri)
throws java.io.IOException
java.io.IOExceptionpublic boolean exists()
ResourceThis method performs a definitive existence check, whereas the
existence of a Resource handle only guarantees a
valid descriptor handle.
public boolean isReadable()
ResourceResource.getInputStream() or Resource.getFile().
Will be true for typical resource descriptors;
note that actual content reading may still fail when attempted.
However, a value of false is a definitive indication
that the resource content cannot be read.
isReadable in interface ResourceResource.getInputStream()public long contentLength()
throws java.io.IOException
ResourcecontentLength in interface Resourcejava.io.IOException - if the resource cannot be resolved
(in the file system or as some other known physical resource type)public long lastModified()
throws java.io.IOException
ResourcelastModified in interface Resourcejava.io.IOException - if the resource cannot be resolved
(in the file system or as some other known physical resource type)