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
 booleanexists()
           
 StringgetDescription()
           
 InputStreamgetInputStream()
          This implementation throws IllegalStateException if attempting to read the underlying stream multiple times.
 booleanisOpen()
           

Methods inherited from class org.springframework.core.io.AbstractResource
equals, getFile, hashCode, toString

Constructor Detail

InputStreamResource

public InputStreamResource(InputStream inputStream, String description)
Create a new InputStreamResource.
Parameters:
inputStream - the InputStream to use
description - where the InputStream comes from
Method Detail

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()

Association Links

to Class java.io.InputStream

to Class java.lang.String