Resource implementation for a given InputStream.
Should only be used if no other specific Resource implementation
is applicable. In particular, prefer ByteArrayResource or any of the
file-based Resource implementations where possible.
In contrast to other Resource implementations, this is a descriptor
for an already opened resource - therefore returning true from
isOpen(). Do not use an InputStreamResource if you need to
keep the resource descriptor somewhere, or if you need to read from a stream
multiple times.
ByteArrayResource, ClassPathResource, FileSystemResource, UrlResource
| Modifier and Type | Field and Description |
|---|---|
| private final String | |
| private final InputStream | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | |
| public | InputStreamResource(InputStream
the InputStream to use inputStream, String where the InputStream comes from description)Create a new InputStreamResource. |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | equals(Object
the reference object with which to compare. other)Overrides org. |
| public boolean | exists()
Overrides org. Implements org. true.
|
| public String | getDescription()
Implements org. |
| public InputStream | getInputStream()
Implements org. |
| public int | hashCode()
Overrides org. |
| public boolean | isOpen()
Overrides org. Overrides default org. true.
|
| description | back to summary |
|---|---|
| private final String description | |
| inputStream | back to summary |
|---|---|
| private final InputStream inputStream | |
| read | back to summary |
|---|---|
| private boolean read | |
| InputStreamResource | back to summary |
|---|---|
| public InputStreamResource(InputStream inputStream) Create a new InputStreamResource.
| |
| InputStreamResource | back to summary |
|---|---|
| public InputStreamResource(InputStream inputStream, String description) Create a new InputStreamResource.
| |
| equals | back to summary |
|---|---|
| public boolean equals(Object other) Overrides org. This implementation compares the underlying InputStream.
| |
| exists | back to summary |
|---|---|
| public boolean exists() Overrides org. Implements org. This implementation always returns
| |
| getDescription | back to summary |
|---|---|
| public String getDescription() Implements org. This implementation returns a description that includes the passed-in description, if any.
| |
| getInputStream | back to summary |
|---|---|
| public InputStream getInputStream() throws IOException, IllegalStateException Implements org. This implementation throws IllegalStateException if attempting to read the underlying stream multiple times.
| |
| hashCode | back to summary |
|---|---|
| public int hashCode() Overrides org. This implementation returns the hash code of the underlying InputStream.
| |
| isOpen | back to summary |
|---|---|
| public boolean isOpen() Overrides org. Overrides default org. This implementation always returns
| |