|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.core.io.AbstractResource
org.springframework.core.io.InputStreamResource
public class InputStreamResource
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.
| Constructor Summary | |
|---|---|
InputStreamResource(InputStream inputStream)
Create a new InputStreamResource. |
|
InputStreamResource(InputStream inputStream,
String description)
Create a new InputStreamResource. |
|
| Method Summary | |
|---|---|
boolean |
exists()
This implementation checks whether a File can be opened, falling back to whether an InputStream can be opened. |
String |
getDescription()
This abstract method declaration shadows the method in the Resource interface. |
InputStream |
getInputStream()
This implementation throws IllegalStateException if attempting to read the underlying stream multiple times. |
boolean |
isOpen()
This implementations always returns false. |
| Methods inherited from class org.springframework.core.io.AbstractResource |
|---|
createRelative, equals, getFile, getFilename, getURL, hashCode, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public InputStreamResource(InputStream inputStream)
inputStream - the InputStream to use
public InputStreamResource(InputStream inputStream,
String description)
inputStream - the InputStream to usedescription - where the InputStream comes from| Method Detail |
|---|
public boolean exists()
AbstractResource
exists in interface Resourceexists in class AbstractResourcepublic boolean isOpen()
AbstractResource
isOpen in interface ResourceisOpen in class AbstractResource
public InputStream getInputStream()
throws IOException,
IllegalStateException
IOException - if the stream could not be opened
IllegalStateExceptionpublic String getDescription()
AbstractResourcetoString implementation in this
class work on Sun's JDK 1.3 classic VM, which can't find the
getDescription method when executing toString else.
getDescription in interface ResourcegetDescription in class AbstractResourceResource.getDescription()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||