org.springframework.core.io
Class InputStreamResource
org.springframework.core.io.AbstractResource
|
+--org.springframework.core.io.InputStreamResource
- public class InputStreamResource
- extends AbstractResource
Resource implementation for a given InputStream. Should only
be used if no specific Resource implementation is applicable.
In contrast to other Resource implementations, this is a descriptor
for an already opened resource - therefore returning true on
isOpen(). Do not use it if you need to keep the resource descriptor
somewhere, or if you need to read a stream multiple times.
- Author:
- Juergen Hoeller
- Since: 28.12.2003
| Constructor Summary |
InputStreamResource(InputStream inputStream, String description) Create a new InputStreamResource. |
| Method Summary |
boolean | exists() |
String | getDescription() |
InputStream | getInputStream() This implementation throws IllegalStateException if attempting to
read the underlying stream multiple times. |
boolean | isOpen() |
InputStreamResource
public InputStreamResource(InputStream inputStream, String description)
- Create a new InputStreamResource.
- Parameters:
- inputStream - the InputStream to use
- description - where the InputStream comes from
exists
public boolean exists()
getDescription
public String getDescription()
getInputStream
public InputStream getInputStream()
throws java.io.IOException,
java.lang.IllegalStateException
- This implementation throws IllegalStateException if attempting to
read the underlying stream multiple times.
isOpen
public boolean isOpen()
to Class java.io.InputStream
to Class java.lang.String