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 anInputStreamfrom a given sourceInputStream. The content of the sourceInputStreamwill be stored in-memory.
-
-
Constructor Summary
Constructors Constructor Description MemoryInputStreamCreator(InputStream source)Creates a newMemoryInputStreamCreatorwith the specifiedsource.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStreamnewInputStream(OutlookMessageAttachment omt)Reads a newInputStreamwith the content of the source.
-
-
-
Constructor Detail
-
MemoryInputStreamCreator
public MemoryInputStreamCreator(InputStream source)
Creates a newMemoryInputStreamCreatorwith the specifiedsource.- Parameters:
source- The source.
-
-
Method Detail
-
newInputStream
public InputStream newInputStream(OutlookMessageAttachment omt) throws IOException
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.
-
-