public class MimeData extends Object
ItemDataType.TYPE_MIME_PART
.
Use TypedAccess.get(String, Class, Object)
with MimeData
to return
the item value in this format or Document.replaceItemValue(String, Object)
to
write it.Constructor and Description |
---|
MimeData() |
MimeData(String html,
String text,
Map<String,IMimeAttachment> embeds,
List<IMimeAttachment> attachments) |
Modifier and Type | Method and Description |
---|---|
void |
attach(IMimeAttachment attachment)
Attaches a file.
|
String |
embed(IMimeAttachment attachment)
Adds an inline file
|
void |
embed(String cid,
IMimeAttachment attachment)
Adds/changes an inline file with a given content id
|
List<IMimeAttachment> |
getAttachments() |
Iterable<String> |
getContentIds()
Returns the content ids for all inline files.
|
Optional<IMimeAttachment> |
getEmbed(String cid)
Returns an attachment for a content id
|
String |
getHtml()
Returns the html content
|
String |
getPlainText()
Returns alternative plaintext content
|
void |
removeAttachment(IMimeAttachment attachment)
Removes an attachment from the MIME data
|
void |
removeEmbed(String cid)
Removes an inline file
|
void |
setHtml(String html)
Sets the HTML content
|
void |
setPlainText(String text)
Sets the alternative plaintext content
|
String |
toString() |
public MimeData()
public MimeData(String html, String text, Map<String,IMimeAttachment> embeds, List<IMimeAttachment> attachments)
public String getHtml()
public void setHtml(String html)
html
- htmlpublic String getPlainText()
public void setPlainText(String text)
text
- plaintextpublic Optional<IMimeAttachment> getEmbed(String cid)
cid
- content idOptional
describing the attachment, or an empty one if the attachment
with that ID does not existpublic String embed(IMimeAttachment attachment)
attachment
- attachmentpublic void embed(String cid, IMimeAttachment attachment)
cid
- content idattachment
- attachmentpublic void removeEmbed(String cid)
cid
- content idpublic Iterable<String> getContentIds()
public void attach(IMimeAttachment attachment)
IMimeAttachment
, e.g. LocalFileMimeAttachment
,
ByteArrayMimeAttachment
or UrlMimeAttachment
or
you can add your own implementation. When reading MimeData
from a document, we transform the attachment to an internal class
that returns the same filename, content type and binary content.attachment
- attachmentpublic List<IMimeAttachment> getAttachments()
public void removeAttachment(IMimeAttachment attachment)
attachment
- attachment to removeCopyright © 2019–2021 HCL. All rights reserved.