public class

InputStreamResource

extends AbstractResource
java.lang.Object
   ↳ org.springframework.core.io.AbstractResource
     ↳ org.springframework.core.io.InputStreamResource

Class Overview

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.

Summary

Public Constructors
InputStreamResource(InputStream inputStream)
Create a new InputStreamResource.
InputStreamResource(InputStream inputStream, String description)
Create a new InputStreamResource.
Public Methods
boolean equals(Object obj)
This implementation compares the underlying InputStream.
boolean exists()
This implementation always returns true.
String getDescription()
This implementation returns the passed-in description, if any.
InputStream getInputStream()
This implementation throws IllegalStateException if attempting to read the underlying stream multiple times.
int hashCode()
This implementation returns the hash code of the underlying InputStream.
boolean isOpen()
This implementation always returns true.
[Expand]
Inherited Methods
From class org.springframework.core.io.AbstractResource
From class java.lang.Object
From interface org.springframework.core.io.InputStreamSource
From interface org.springframework.core.io.Resource

Public Constructors

public InputStreamResource (InputStream inputStream)

Also: SpringCore

Create a new InputStreamResource.

Parameters
inputStream the InputStream to use

public InputStreamResource (InputStream inputStream, String description)

Also: SpringCore

Create a new InputStreamResource.

Parameters
inputStream the InputStream to use
description where the InputStream comes from

Public Methods

public boolean equals (Object obj)

This implementation compares the underlying InputStream.

public boolean exists ()

Also: SpringCore

This implementation always returns true.

public String getDescription ()

Also: SpringCore

This implementation returns the passed-in description, if any.

public InputStream getInputStream ()

Also: SpringCore

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

Also: SpringCore

This implementation always returns true.