Package de.aristaflow.adept2.model.mail
Class ByteArrayAttachment
java.lang.Object
de.aristaflow.adept2.model.mail.SerialisableAttachment
de.aristaflow.adept2.model.mail.ByteArrayAttachment
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable
A
SerialisableAttachment having plain byte[] content.- See Also:
-
Field Summary
FieldsFields inherited from class de.aristaflow.adept2.model.mail.SerialisableAttachment
contentType, description, inlineName, name -
Constructor Summary
ConstructorsConstructorDescriptionByteArrayAttachment(String name, String description, byte[] bytes) Creates an attachment having the designated name, description and content.ByteArrayAttachment(String name, String description, byte[] bytes, boolean inline) Creates an attachment having the designated name, description and content.ByteArrayAttachment(String name, String description, byte[] bytes, String inlineName) Creates an attachment having the designated name, description and content.ByteArrayAttachment(String name, String description, String contentType, byte[] bytes) Creates an attachment having the designated name, description, content type (MIME) and content.ByteArrayAttachment(String name, String description, String contentType, byte[] bytes, boolean inline) Creates an attachment having the designated name, description, content type (MIME) and content.ByteArrayAttachment(String name, String description, String contentType, byte[] bytes, String inlineName) Creates an attachment having the designated name, description, content type (MIME) and content.ByteArrayAttachment(String name, String description, String contentType, InputStream content, String inlineName) Creates an attachment having the designated name, description, content type (MIME) and content retrieved from the designated string. -
Method Summary
Modifier and TypeMethodDescriptionGets the content of the attachment represented asInputStream.Methods inherited from class de.aristaflow.adept2.model.mail.SerialisableAttachment
close, getContentType, getDescription, getInlineName, getName
-
Field Details
-
bytes
protected final byte[] bytesThe content represented asbyte[].
-
-
Constructor Details
-
ByteArrayAttachment
Creates an attachment having the designated name, description and content. The content type is set to "application/octet-stream".- Parameters:
name- The name of the attachment.description- The description of the attachment.bytes- The content of the attachment represented asbyte[].
-
ByteArrayAttachment
Creates an attachment having the designated name, description and content. The content type is set to "application/octet-stream".- Parameters:
name- The name of the attachment.description- The description of the attachment.bytes- The content of the attachment represented asbyte[].inline- Whether to inline this attachment in case of an HTML message using the designated name.
-
ByteArrayAttachment
Creates an attachment having the designated name, description and content. The content type is set to "application/octet-stream".- Parameters:
name- The name of the attachment.description- The description of the attachment.bytes- The content of the attachment represented asbyte[].inlineName- The name used in the corresponding HTML message to refer to this attachment to be inlined. Usenullto not inline the attachment.
-
ByteArrayAttachment
Creates an attachment having the designated name, description, content type (MIME) and content.- Parameters:
name- The name of the attachment.description- The description of the attachment.contentType- The content type (MIME) of the attachment.bytes- The content of the attachment represented asbyte[].
-
ByteArrayAttachment
public ByteArrayAttachment(String name, String description, String contentType, byte[] bytes, boolean inline) Creates an attachment having the designated name, description, content type (MIME) and content.- Parameters:
name- The name of the attachment.description- The description of the attachment.contentType- The content type (MIME) of the attachment.bytes- The content of the attachment represented asbyte[].inline- Whether to inline this attachment in case of an HTML message using the designated name.
-
ByteArrayAttachment
public ByteArrayAttachment(String name, String description, String contentType, byte[] bytes, String inlineName) Creates an attachment having the designated name, description, content type (MIME) and content.- Parameters:
name- The name of the attachment.description- The description of the attachment.contentType- The content type (MIME) of the attachment.bytes- The content of the attachment represented asbyte[].inlineName- The name used in the corresponding HTML message to refer to this attachment to be inlined. Usenullto not inline the attachment.
-
ByteArrayAttachment
public ByteArrayAttachment(String name, String description, String contentType, InputStream content, String inlineName) throws IOException Creates an attachment having the designated name, description, content type (MIME) and content retrieved from the designated string.- Parameters:
name- The name of the attachment.description- The description of the attachment.contentType- The content type (MIME) of the attachment.content- The content of the attachment represented asInputStream. The stream will be closed after the creation.inlineName- The name used in the corresponding HTML message to refer to this attachment to be inlined. Usenullto not inline the attachment.- Throws:
IOException- If there is a problem reading the content from the designated stream, anIOExceptionwill be thrown.
-
-
Method Details
-
getContent
Description copied from class:SerialisableAttachmentGets the content of the attachment represented asInputStream.
Note that this should only be called by the receiving service since theInputStreamcannot be serialised.- Specified by:
getContentin classSerialisableAttachment- Returns:
- The actual data of the attachment. The caller is responsible for closing.
-