Package de.aristaflow.adept2.model.mail
Class SerialisableAttachment
- java.lang.Object
- 
- de.aristaflow.adept2.model.mail.SerialisableAttachment
 
- 
- All Implemented Interfaces:
- Closeable,- Serializable,- AutoCloseable
 - Direct Known Subclasses:
- ByteArrayAttachment,- DataSourceAttachment,- UDTAttachment,- URLAttachment
 
 public abstract class SerialisableAttachment extends Object implements Serializable, Closeable Attachments for sending via theMailService. Mail attachments have a name, a description, a content type (MIME) and binary content. The content can be represented arbitrarily.
 Note that this attachment needs to be serialisable (which also applies to the subclasses). Otherwise it cannot be used with theMailService.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected StringcontentTypeThe content type (MIME) of the attachment.protected StringdescriptionThe description of the attachment.protected StringinlineNameThe name used in the corresponding HTML message to refer to this attachment.protected StringnameThe name of the attachment.
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedSerialisableAttachment(String name, String description)Creates an attachment having the designated name and description.protectedSerialisableAttachment(String name, String description, boolean inline)Creates an attachment having the designated name and description.protectedSerialisableAttachment(String name, String description, String contentType)Creates an attachment having the designated name, description and content type (MIME).protectedSerialisableAttachment(String name, String description, String contentType, boolean inline)Creates an attachment having the designated name, description and content type (MIME).protectedSerialisableAttachment(String name, String description, String contentType, String inlineName)Creates an attachment having the designated name, description and content type (MIME).
 - 
Method SummaryAll Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidclose()abstract InputStreamgetContent()Gets the content of the attachment represented asInputStream.StringgetContentType()Gets the content type (MIME) of the attachment.StringgetDescription()Gets the description of the attachment.StringgetInlineName()Gets the name used in the corresponding HTML message to refer to this attachment.StringgetName()Gets the name of the attachment.
 
- 
- 
- 
Field Detail- 
nameprotected final String name The name of the attachment.
 - 
descriptionprotected final String description The description of the attachment.
 - 
contentTypeprotected final String contentType The content type (MIME) of the attachment.
 - 
inlineNameprotected final String inlineName The name used in the corresponding HTML message to refer to this attachment. This name will be replaced within the message by the corresponding referenced to this attachment.nullif the attachment should not be inlined.
 
- 
 - 
Constructor Detail- 
SerialisableAttachmentprotected SerialisableAttachment(String name, String description) Creates an attachment having the designated name and description. The content type is set to "application/octet-stream".- Parameters:
- name- The name of the attachment.
- description- The description of the attachment.
 
 - 
SerialisableAttachmentprotected SerialisableAttachment(String name, String description, boolean inline) Creates an attachment having the designated name and description. The content type is set to "application/octet-stream".- Parameters:
- name- The name of the attachment.
- description- The description of the attachment.
- inline- Whether to inline this attachment in case of an HTML message using the designated name.
 
 - 
SerialisableAttachmentprotected SerialisableAttachment(String name, String description, String contentType) Creates an attachment having the designated name, description and content type (MIME).- Parameters:
- name- The name of the attachment.
- description- The description of the attachment.
- contentType- The content type (MIME) of the attachment.
 
 - 
SerialisableAttachmentprotected SerialisableAttachment(String name, String description, String contentType, boolean inline) Creates an attachment having the designated name, description and content type (MIME).- Parameters:
- name- The name of the attachment.
- description- The description of the attachment.
- contentType- The content type (MIME) of the attachment.
- inline- Whether to inline this attachment in case of an HTML message using the designated name.
 
 - 
SerialisableAttachmentprotected SerialisableAttachment(String name, String description, String contentType, String inlineName) Creates an attachment having the designated name, description and content type (MIME).- Parameters:
- name- The name of the attachment.
- description- The description of the attachment.
- contentType- The content type (MIME) of the attachment.
- inlineName- The name used in the corresponding HTML message to refer to this attachment to be inlined. Use- nullto not inline the attachment.
 
 
- 
 - 
Method Detail- 
getNamepublic String getName() Gets the name of the attachment.- Returns:
- The name of the attachment.
 
 - 
getDescriptionpublic String getDescription() Gets the description of the attachment.- Returns:
- The description of the attachment.
 
 - 
getContentTypepublic String getContentType() Gets the content type (MIME) of the attachment.- Returns:
- The content type (MIME) of the attachment.
 
 - 
getInlineNamepublic String getInlineName() Gets the name used in the corresponding HTML message to refer to this attachment. This name will be replaced within the message by the corresponding referenced to this attachment.nullif the attachment should not be inlined.- Returns:
- The name used in the corresponding HTML message to refer to this attachment to be
         inlined, nullto not inline the attachment.
 
 - 
getContentpublic abstract InputStream getContent() throws IOException Gets the content of the attachment represented asInputStream.
 Note that this should only be called by the receiving service since theInputStreamcannot be serialised.- Returns:
- The actual data of the attachment. The caller is responsible for closing.
- Throws:
- IOException- If there are problems retrieving the content, for instance converting the transferred serialisable data to an- InputStream, an- IOExceptionwill be thrown.
 
 - 
closepublic void close() throws IOException- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
- Throws:
- IOException
 
 
- 
 
-