Package ch.astorm.jotlmsg
Class OutlookMessageAttachment.MemoryInputStreamCreator
java.lang.Object
ch.astorm.jotlmsg.OutlookMessageAttachment.MemoryInputStreamCreator
- All Implemented Interfaces:
OutlookMessageAttachment.InputStreamCreator
- Enclosing class:
OutlookMessageAttachment
public static class OutlookMessageAttachment.MemoryInputStreamCreator
extends Object
implements OutlookMessageAttachment.InputStreamCreator
Wraps the creation of an
InputStream from a given source InputStream.
The content of the source InputStream will be stored in-memory.-
Constructor Summary
ConstructorsConstructorDescriptionMemoryInputStreamCreator(InputStream source) Creates a newMemoryInputStreamCreatorwith the specifiedsource. -
Method Summary
Modifier and TypeMethodDescriptionReads a newInputStreamwith the content of the source.
-
Constructor Details
-
MemoryInputStreamCreator
Creates a newMemoryInputStreamCreatorwith the specifiedsource.- Parameters:
source- The source.
-
-
Method Details
-
newInputStream
Reads a newInputStreamwith the content of the source. The first time this method is called, the sourceInputStreamwill be fully read, closed and stored in-memory. Then, a newByteArrayInputStreamis returned.- Specified by:
newInputStreamin interfaceOutlookMessageAttachment.InputStreamCreator- Parameters:
omt- The attachment.- Returns:
- A new
ByteArrayInputStream. - Throws:
IOException- If an I/O error occurs.
-