public class DescriptiveResource extends AbstractResource
Resource implementation that holds a resource description
but does not point to an actually readable resource.
To be used as placeholder if a Resource argument is
expected by an API but not necessarily used for actual reading.
| 构造器和说明 |
|---|
DescriptiveResource(String description)
Create a new DescriptiveResource.
|
| 限定符和类型 | 方法和说明 |
|---|---|
boolean |
equals(Object obj)
This implementation compares the underlying description String.
|
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.
|
InputStream |
getInputStream()
Return an
InputStream. |
int |
hashCode()
This implementation returns the hash code of the underlying description String.
|
boolean |
isReadable()
This implementation always returns
true. |
contentLength, createRelative, getFile, getFileForLastModifiedCheck, getFilename, getURI, getURL, isOpen, lastModified, toStringpublic DescriptiveResource(String description)
description - the resource descriptionpublic boolean exists()
AbstractResourceexists 在接口中 Resourceexists 在类中 AbstractResourcepublic boolean isReadable()
AbstractResourcetrue.isReadable 在接口中 ResourceisReadable 在类中 AbstractResourceInputStreamSource.getInputStream()public InputStream getInputStream() throws IOException
InputStreamSourceInputStream.
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 String getDescription()
ResourceImplementations are also encouraged to return this value
from their toString method.
Object.toString()public boolean equals(Object obj)
equals 在类中 AbstractResourceResource.getDescription()public int hashCode()
hashCode 在类中 AbstractResourceResource.getDescription()Copyright © 2018 jretty-org. All rights reserved.