public interface InputStreamResource
This is the base interface for Spring's more extensive
For single-use streams,
InputStreamResource can be used for any
InputStream. Spring's ByteArrayResource or any
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.
Code copied from Spring source. Modifications made (mostly removal of methods) by Per Wendel.
InputStream getInputStream() throws IOException
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
getInputStream() call returns a fresh stream.
IOException- if the stream could not be opened
Copyright © 2015. All rights reserved.