public class VfsResource extends AbstractResource
Resource
implementation.
Supports the corresponding VFS API versions on JBoss AS 5.x as well as 6.x and 7.x.org.jboss.virtual.VirtualFile
,
org.jboss.vfs.VirtualFile
构造器和说明 |
---|
VfsResource(Object resources) |
限定符和类型 | 方法和说明 |
---|---|
long |
contentLength()
This implementation reads the entire InputStream to calculate the
content length.
|
Resource |
createRelative(String relativePath)
This implementation throws a FileNotFoundException, assuming
that relative resources cannot be created for this resource.
|
boolean |
equals(Object obj)
This implementation compares description strings.
|
boolean |
exists()
This implementation checks whether a File can be opened,
falling back to whether an InputStream can be opened.
|
String |
getDescription()
Return a description for this resource,
to be used for error output when working with the resource.
|
File |
getFile()
This implementation throws a FileNotFoundException, assuming
that the resource cannot be resolved to an absolute file path.
|
String |
getFilename()
This implementation always returns
null ,
assuming that this resource type does not have a filename. |
InputStream |
getInputStream()
Return an
InputStream . |
URI |
getURI()
This implementation builds a URI based on the URL returned
by
AbstractResource.getURL() . |
URL |
getURL()
This implementation throws a FileNotFoundException, assuming
that the resource cannot be resolved to a URL.
|
int |
hashCode()
This implementation returns the description's hash code.
|
boolean |
isReadable()
This implementation always returns
true . |
long |
lastModified()
This implementation checks the timestamp of the underlying File,
if available.
|
getFileForLastModifiedCheck, isOpen, toString
public VfsResource(Object resources)
public InputStream getInputStream() throws IOException
InputStreamSource
InputStream
.
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 getInputStream()
call returns a fresh stream.
null
)IOException
- if the stream could not be opened
·public boolean exists()
AbstractResource
exists
在接口中 Resource
exists
在类中 AbstractResource
public boolean isReadable()
AbstractResource
true
.isReadable
在接口中 Resource
isReadable
在类中 AbstractResource
InputStreamSource.getInputStream()
public URL getURL() throws IOException
AbstractResource
getURL
在接口中 Resource
getURL
在类中 AbstractResource
IOException
- if the resource cannot be resolved as URL,
i.e. if the resource is not available as descriptorpublic URI getURI() throws IOException
AbstractResource
AbstractResource.getURL()
.getURI
在接口中 Resource
getURI
在类中 AbstractResource
IOException
- if the resource cannot be resolved as URI,
i.e. if the resource is not available as descriptorpublic File getFile() throws IOException
AbstractResource
getFile
在接口中 Resource
getFile
在类中 AbstractResource
IOException
- if the resource cannot be resolved as absolute
file path, i.e. if the resource is not available in a file systempublic long contentLength() throws IOException
AbstractResource
contentLength
在接口中 Resource
contentLength
在类中 AbstractResource
IOException
- 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
AbstractResource
lastModified
在接口中 Resource
lastModified
在类中 AbstractResource
IOException
- if the resource cannot be resolved
(in the file system or as some other known physical resource type)AbstractResource.getFileForLastModifiedCheck()
public Resource createRelative(String relativePath) throws IOException
AbstractResource
createRelative
在接口中 Resource
createRelative
在类中 AbstractResource
relativePath
- the relative path (relative to this resource)IOException
- if the relative resource cannot be determinedpublic String getFilename()
AbstractResource
null
,
assuming that this resource type does not have a filename.getFilename
在接口中 Resource
getFilename
在类中 AbstractResource
public String getDescription()
Resource
Implementations are also encouraged to return this value
from their toString
method.
Object.toString()
public boolean equals(Object obj)
AbstractResource
equals
在类中 AbstractResource
Resource.getDescription()
public int hashCode()
AbstractResource
hashCode
在类中 AbstractResource
Resource.getDescription()
Copyright © 2018 jretty-org. All rights reserved.