Spring for Android

org.springframework.core.io
Interface InputStreamSource

All Known Subinterfaces:
Resource, WritableResource
All Known Implementing Classes:
AbstractFileResolvingResource, AbstractResource, AssetResource, ByteArrayResource, ClassPathResource, FileSystemResource, InputStreamResource, UrlResource

public interface InputStreamSource

Simple interface for objects that are sources for an InputStream.

This is the base interface for Spring's more extensive Resource interface.

For single-use streams, InputStreamResource can be used for any given InputStream. Spring's ByteArrayResource or any file-based Resource implementation can be used as a concrete instance, allowing one to read the underlying content stream multiple times. This makes this interface useful as an abstract content source for mail attachments, for example.

Since:
1.0
Author:
Juergen Hoeller
See Also:
InputStream, Resource, InputStreamResource, ByteArrayResource

Method Summary
 java.io.InputStream getInputStream()
          Return an InputStream.
 

Method Detail

getInputStream

java.io.InputStream getInputStream()
                                   throws java.io.IOException
Return an InputStream.

It is expected that each call creates a fresh stream.

This requirement is particularly important when you consider an API such as JavaMail, which needs to be able to read the stream multiple times when creating mail attachments. For such a use case, it is required that each getInputStream() call returns a fresh stream.

Throws:
java.io.IOException - if the stream could not be opened

Spring for Android