public abstract class AbstractFileResolvingResource extends 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.
Based on https://github.com/spring-projects/spring-framework/blob/master/spring-core/src/main/java/org/springframework/core/io/AbstractFileResolvingResource.java
| 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.
|
File |
getFile() |
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()
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 File getFile() throws IOException
getFile in interface ResourceIOException - if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file systempublic 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 IOException
ResourcecontentLength in interface ResourceIOException - if the resource cannot be resolved
(in the file system or as some other known physical resource type)public long lastModified()
throws IOException
ResourcelastModified in interface ResourceIOException - if the resource cannot be resolved
(in the file system or as some other known physical resource type)protected File getFileForLastModifiedCheck() throws IOException
IOException - if there is an errorprotected File getFile(URI uri) throws IOException
uri - The URIIOException - if there is an error