public abstract class EmailAttachment
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
protected java.lang.String |
contentId |
protected java.lang.String |
name |
protected int |
size |
protected EmailMessage |
targetMessage |
Modifier | Constructor and Description |
---|---|
protected |
EmailAttachment(java.lang.String name,
java.lang.String contentId)
Creates new attachment with given name and content id for inline attachments.
|
Modifier and Type | Method and Description |
---|---|
static EmailAttachmentBuilder |
attachment()
Creates
builder for convenient
building of the email attachments. |
java.lang.String |
getContentId()
Returns content id for inline attachments.
|
abstract javax.activation.DataSource |
getDataSource()
Returns
DataSource implementation, depending of attachment source. |
java.lang.String |
getEncodedName()
Returns encoded attachment name.
|
java.lang.String |
getName()
Returns attachment name.
|
int |
getSize()
Returns size of received attachment,
|
boolean |
isEmbeddedInto(EmailMessage emailMessage)
Returns
true if attachment is embedded into provided message. |
boolean |
isInline()
Returns
true if it is inline attachment. |
void |
setEmbeddedMessage(EmailMessage emailMessage)
Sets target message for embedded attachments.
|
protected void |
setSize(int size) |
byte[] |
toByteArray()
Returns byte content of the attachment.
|
void |
writeToFile(java.io.File destination)
Saves attachment to a file.
|
void |
writeToStream(java.io.OutputStream out)
Saves attachment to output stream.
|
protected final java.lang.String name
protected final java.lang.String contentId
protected EmailMessage targetMessage
protected int size
protected EmailAttachment(java.lang.String name, java.lang.String contentId)
null
if attachment is not embedded.
Email name may be null
as well.public static EmailAttachmentBuilder attachment()
builder
for convenient
building of the email attachments.public java.lang.String getName()
null
.public java.lang.String getEncodedName()
null
.public java.lang.String getContentId()
null
when attachment is not embedded.public boolean isInline()
true
if it is inline attachment.public void setEmbeddedMessage(EmailMessage emailMessage)
public boolean isEmbeddedInto(EmailMessage emailMessage)
true
if attachment is embedded into provided message.public abstract javax.activation.DataSource getDataSource()
DataSource
implementation, depending of attachment source.public int getSize()
protected void setSize(int size)
public byte[] toByteArray()
public void writeToFile(java.io.File destination)
public void writeToStream(java.io.OutputStream out)
Copyright © 2003-2013 Jodd Team