Save This Page
Home » spring-framework-2.5.5-with-dependencies » org.springframework » core » io » [javadoc | source]
org.springframework.core.io
public class: InputStreamResource [javadoc | source]
java.lang.Object
   org.springframework.core.io.AbstractResource
      org.springframework.core.io.InputStreamResource

All Implemented Interfaces:
    Resource

Resource implementation for a given InputStream. Should only be used if no 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 it if you need to keep the resource descriptor somewhere, or if you need to read a stream multiple times.

Constructor:
 public InputStreamResource(InputStream inputStream) 
    Create a new InputStreamResource.
    Parameters:
    inputStream - the InputStream to use
 public InputStreamResource(InputStream inputStream,
    String description) 
    Create a new InputStreamResource.
    Parameters:
    inputStream - the InputStream to use
    description - where the InputStream comes from
Method from org.springframework.core.io.InputStreamResource Summary:
equals,   exists,   getDescription,   getInputStream,   hashCode,   isOpen
Methods from org.springframework.core.io.AbstractResource:
createRelative,   equals,   exists,   getFile,   getFileForLastModifiedCheck,   getFilename,   getURI,   getURL,   hashCode,   isOpen,   isReadable,   lastModified,   toString
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.springframework.core.io.InputStreamResource Detail:
 public boolean equals(Object obj) 
    This implementation compares the underlying InputStream.
 public boolean exists() 
    This implementation always returns true.
 public String getDescription() 
    This implementation returns the passed-in description, if any.
 public InputStream getInputStream() throws IOException, IllegalStateException 
    This implementation throws IllegalStateException if attempting to read the underlying stream multiple times.
 public int hashCode() 
    This implementation returns the hash code of the underlying InputStream.
 public boolean isOpen() 
    This implementation always returns true.