Resource implementation.
As of Spring 4.0, this class supports VFS 3.x on JBoss AS 6+
(package org.jboss.vfs) and is in particular compatible with
JBoss AS 7 and WildFly 8+.
| Access | Constructor and Description |
|---|---|
| public | VfsResource(Object
a resource)org.jboss.vfs.VirtualFile instance
(untyped in order to avoid a static dependency on the VFS API)Create a new |
| Modifier and Type | Method and Description |
|---|---|
| public long | contentLength()
Overrides org. Implements org. This method reads the entire InputStream to determine the content length. |
| public Resource | createRelative(String
the relative path (relative to this resource) relativePath)Overrides org. Implements org. This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource. |
| public boolean | equals(Object
the reference object with which to compare. other)Overrides org. This implementation compares description strings. |
| public boolean | exists()
Overrides org. Implements org. This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened. |
| public String | getDescription()
Implements org. Return a description for this resource, to be used for error output when working with the resource. |
| public File | getFile()
Overrides org. Implements org. This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path. |
| public String | getFilename()
Overrides org. Implements org. This implementation always returns |
| public InputStream | getInputStream()
Implements org. Return an |
| public URI | getURI()
Overrides org. Implements org. This implementation builds a URI based on the URL returned
by |
| public URL | getURL()
Overrides org. Implements org. This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL. |
| public int | hashCode()
Overrides org. This implementation returns the description's hash code. |
| public boolean | isReadable()
Overrides org. Overrides default org. This implementation always returns |
| public long | lastModified()
Overrides org. Implements org. This implementation checks the timestamp of the underlying File, if available. |
| resource | back to summary |
|---|---|
| private final Object resource | |
| VfsResource | back to summary |
|---|---|
| public VfsResource(Object resource) Create a new
| |
| contentLength | back to summary |
|---|---|
| public long contentLength() throws IOException Overrides org. Implements org. Doc from org. This method reads the entire InputStream to determine the content length. For a custom subclass of
| |
| createRelative | back to summary |
|---|---|
| public Resource createRelative(String relativePath) throws IOException Overrides org. Implements org. Doc from org. This implementation throws a FileNotFoundException, assuming that relative resources cannot be created for this resource.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides org. Doc from org. This implementation compares description strings.
| |
| exists | back to summary |
|---|---|
| public boolean exists() Overrides org. Implements org. Doc from org. 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.
| |
| getDescription | back to summary |
|---|---|
| public String getDescription() Implements org. Doc from org. Return a description for this resource, to be used for error output when working with the resource. Implementations are also encouraged to return this value
from their
| |
| getFile | back to summary |
|---|---|
| public File getFile() throws IOException Overrides org. Implements org. Doc from org. This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to an absolute file path.
| |
| getFilename | back to summary |
|---|---|
| public String getFilename() Overrides org. Implements org. Doc from org. This implementation always returns
| |
| getInputStream | back to summary |
|---|---|
| public InputStream getInputStream() throws IOException Implements org. Doc from org. Return an It is expected that each call creates a fresh stream. This requirement is particularly important when you consider an API such
as JavaMail, which needs to be able to read the stream multiple times when
creating mail attachments. For such a use case, it is required
that each
| |
| getURI | back to summary |
|---|---|
| public URI getURI() throws IOException Overrides org. Implements org. Doc from org. This implementation builds a URI based on the URL returned
by
| |
| getURL | back to summary |
|---|---|
| public URL getURL() throws IOException Overrides org. Implements org. Doc from org. This implementation throws a FileNotFoundException, assuming that the resource cannot be resolved to a URL.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides org. Doc from org. This implementation returns the description's hash code.
| |
| isReadable | back to summary |
|---|---|
| public boolean isReadable() Overrides org. Overrides default org. Doc from org. This implementation always returns
| |
| lastModified | back to summary |
|---|---|
| public long lastModified() throws IOException Overrides org. Implements org. Doc from org. This implementation checks the timestamp of the underlying File, if available.
| |