Package de.aristaflow.adept2.model.mail
Class SerialisableAttachmentDataSource
java.lang.Object
de.aristaflow.adept2.model.mail.SerialisableAttachmentDataSource
- All Implemented Interfaces:
jakarta.activation.DataSource,Closeable,AutoCloseable
public class SerialisableAttachmentDataSource
extends Object
implements jakarta.activation.DataSource, Closeable
This class wraps a
SerialisableAttachment in a DataSource to allow for
easily attaching to messages created with Commons Mail. Name, content and content type will be
taken over, getOutputStream() will not work since writing to an attachment does not make
sense – at least at the time this data source is being used.-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final SerialisableAttachmentThe wrapped serialisable attachment.protected final Cleanup<IOException>The clean-up for closing theSerialisableAttachmentsattas post-mortem task for this instance. -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new wrapper for aSerialisableAttachment. -
Method Summary
-
Field Details
-
att
The wrapped serialisable attachment. -
cleanup
The clean-up for closing theSerialisableAttachmentsattas post-mortem task for this instance.
-
-
Constructor Details
-
SerialisableAttachmentDataSource
Creates a new wrapper for aSerialisableAttachment.- Parameters:
att- The wrapped serialisable attachment.
-
-
Method Details
-
getName
- Specified by:
getNamein interfacejakarta.activation.DataSource
-
getContentType
- Specified by:
getContentTypein interfacejakarta.activation.DataSource
-
getInputStream
- Specified by:
getInputStreamin interfacejakarta.activation.DataSource- Throws:
IOException
-
getOutputStream
- Specified by:
getOutputStreamin interfacejakarta.activation.DataSource- Throws:
IOException
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-