org.springframework.core.io
Class AbstractFileResolvingResource
java.lang.Object
org.springframework.core.io.AbstractResource
org.springframework.core.io.AbstractFileResolvingResource
- All Implemented Interfaces:
- InputStreamSource, Resource
- Direct Known Subclasses:
- ClassPathResource, UrlResource
public abstract class AbstractFileResolvingResource
- extends AbstractResource
Abstract base class for resources which resolve URLs into File references,
such as UrlResource
or ClassPathResource
.
Detects the "file" protocol as well as the JBoss "vfs" protocol in URLs,
resolving file system references accordingly.
- Since:
- 3.0
- Author:
- Juergen Hoeller
Method Summary |
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). |
Methods inherited from class org.springframework.core.io.AbstractResource |
createRelative, equals, exists, getFilename, getURI, getURL, hashCode, isOpen, isReadable, lastModified, toString |
AbstractFileResolvingResource
public AbstractFileResolvingResource()
getFile
public File getFile()
throws IOException
- This implementation returns a File reference for the underlying class path
resource, provided that it refers to a file in the file system.
- Specified by:
getFile
in interface Resource
- Overrides:
getFile
in class AbstractResource
- Throws:
IOException
- if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file system- See Also:
ResourceUtils.getFile(java.net.URL, String)
getFileForLastModifiedCheck
protected File getFileForLastModifiedCheck()
throws IOException
- This implementation determines the underlying File
(or jar file, in case of a resource in a jar/zip).
- Overrides:
getFileForLastModifiedCheck
in class AbstractResource
- Returns:
- the File to use for timestamp checking (never
null
)
- Throws:
IOException
- if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file system
getFile
protected File getFile(URI uri)
throws IOException
- This implementation returns a File reference for the underlying class path
resource, provided that it refers to a file in the file system.
- Throws:
IOException
- See Also:
ResourceUtils.getFile(java.net.URI, String)