@FullyTested public final class EmailMessageBinaryAttachmentBuilderImp extends Object implements EmailMessageBinaryAttachmentBuilder
JavaMailSessionBuilderFactory.INSTANCE| Constructor and Description |
|---|
EmailMessageBinaryAttachmentBuilderImp(EmailMessageBuilder parentBuilder) |
| Modifier and Type | Method and Description |
|---|---|
EmailMessageBinaryAttachmentBuilder |
attachBinaryData(byte[] byteArr,
IsEmptyAllowed isEmptyAllowed)
Adds new attachment to the parent builder.
|
EmailMessageBinaryAttachmentBuilder |
attachBinaryFile(File filePath,
IsEmptyAllowed isEmptyAllowed)
Immediately reads the contents of the file as binary data, then adds new attachment to the parent builder.
|
EmailMessageBinaryAttachmentBuilder |
attachBinaryInputStream(InputStream inputStream,
IsEmptyAllowed isEmptyAllowed)
Immediately reads the contents of the
InputStream as binary data,
then adds new attachment to the parent builder. |
EmailMessageBinaryAttachmentBuilder |
attachmentFileName(String attachmentFileName)
This is the most common attachment type.
|
EmailMessageBinaryAttachmentBuilder |
attachMessage(javax.mail.Message message)
Converts a MIME message to binary data, then adds new attachment to the parent builder.
|
EmailMessageBinaryAttachmentBuilder |
inline()
RARE: Sets the attachment type to
EmailMessageAttachmentType.INLINE and clears the attachment file name. |
EmailMessageBinaryAttachmentBuilder |
mimeType(String mimeType)
Sets the MIME type.
|
EmailMessageBuilder |
parent()
Access the parent email message builder
|
public EmailMessageBinaryAttachmentBuilderImp(EmailMessageBuilder parentBuilder)
public EmailMessageBuilder parent()
parent in interface EmailMessageBinaryAttachmentBuilderpublic EmailMessageBinaryAttachmentBuilder attachmentFileName(String attachmentFileName)
Sets the attachment type to EmailMessageAttachmentType.ATTACHMENT and sets the attachment file name.
attachmentFileName in interface EmailMessageBinaryAttachmentBuilderattachmentFileName - only a file name -- does not include a parent path
"binary_data.bin"EmailMessageBinaryAttachmentBuilder.inline()public EmailMessageBinaryAttachmentBuilder inline()
EmailMessageAttachmentType.INLINE and clears the attachment file name.inline in interface EmailMessageBinaryAttachmentBuilderEmailMessageBinaryAttachmentBuilder.attachmentFileName(String)public EmailMessageBinaryAttachmentBuilder mimeType(String mimeType)
"application/octet-stream".
See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
mimeType in interface EmailMessageBinaryAttachmentBuilderpublic EmailMessageBinaryAttachmentBuilder attachMessage(javax.mail.Message message) throws Exception
attachMessage in interface EmailMessageBinaryAttachmentBuildermessage - MIME message to attachException - on I/O exceptionJavaMailMessageService.getMimeContentAsByteArr(Message),
EmailMessageBinaryAttachmentBuilder.attachBinaryFile(File, IsEmptyAllowed),
EmailMessageBinaryAttachmentBuilder.attachBinaryInputStream(InputStream, IsEmptyAllowed),
EmailMessageBinaryAttachmentBuilder.attachBinaryData(byte[], IsEmptyAllowed)public EmailMessageBinaryAttachmentBuilder attachBinaryFile(File filePath, IsEmptyAllowed isEmptyAllowed) throws Exception
attachBinaryFile in interface EmailMessageBinaryAttachmentBuilderfilePath - path to file with textisEmptyAllowed - normally, use IsEmptyAllowed.NOException - on I/O exception
isEmptyAllowed is IsEmptyAllowed.NO and the file is emptyEmailMessageBinaryAttachmentBuilder.attachMessage(Message),
EmailMessageBinaryAttachmentBuilder.attachBinaryInputStream(InputStream, IsEmptyAllowed),
EmailMessageBinaryAttachmentBuilder.attachBinaryData(byte[], IsEmptyAllowed)public EmailMessageBinaryAttachmentBuilder attachBinaryInputStream(InputStream inputStream, IsEmptyAllowed isEmptyAllowed) throws Exception
InputStream as binary data,
then adds new attachment to the parent builder.attachBinaryInputStream in interface EmailMessageBinaryAttachmentBuilderinputStream - unlike most Java APIs, the input stream is closed after reading. This is the source or many hidden bugs!
InputStream.close()isEmptyAllowed - normally, use IsEmptyAllowed.NOException - on I/O exception
isEmptyAllowed is IsEmptyAllowed.NO and inputStream is emptyEmailMessageBinaryAttachmentBuilder.attachMessage(Message),
EmailMessageBinaryAttachmentBuilder.attachBinaryFile(File, IsEmptyAllowed),
EmailMessageBinaryAttachmentBuilder.attachBinaryData(byte[], IsEmptyAllowed)public EmailMessageBinaryAttachmentBuilder attachBinaryData(byte[] byteArr, IsEmptyAllowed isEmptyAllowed)
attachBinaryData in interface EmailMessageBinaryAttachmentBuilderbyteArr - byte array for attachmentisEmptyAllowed - normally, use IsEmptyAllowed.NOEmailMessageBinaryAttachmentBuilder.attachMessage(Message),
EmailMessageBinaryAttachmentBuilder.attachBinaryFile(File, IsEmptyAllowed),
EmailMessageBinaryAttachmentBuilder.attachBinaryInputStream(InputStream, IsEmptyAllowed)Copyright © 2013–2020. All rights reserved.