public abstract class ReferencedMailPart extends MailPart implements ComposedMailPart
ReferencedMailPart - A MailPart implementation that points to a referenced part in original mail.
Since a mail part causes troubles when its input stream is read multiple times, corresponding data is either stored in an internal byte
array or copied as a temporary file to disk (depending on TransportConfig#getReferencedPartLimit()). Therefore this part needs
special handling to ensure removal of temporary file when it is dispatched.
ComposedMailPart.ComposedPartTypeNO_ENCLOSED_PARTS| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
getContent()
Returns the part's content as a Java object dependent on underlying implementation.
|
javax.activation.DataHandler |
getDataHandler()
Returns an appropriate
DataHandler for this mail part. |
int |
getEnclosedCount()
Gets the number of enclosed mail parts.
|
MailPart |
getEnclosedMailPart(int index)
Gets the mail part located at given index.
|
java.lang.String |
getFileID()
Gets this referenced part's file ID if its content has been written to disc.
|
java.io.InputStream |
getInputStream()
Returns an input stream for this part.
|
ComposedMailPart.ComposedPartType |
getType() |
boolean |
isMail()
Checks if referenced part is a mail
|
void |
loadContent()
Ensures that the part's content is loaded, thus this part is independent of the original.
|
void |
prepareForCaching()
Prepares this mail part to be put into cache; meaning to release all kept resources
|
addHeader, addHeaders, clone, containsContentDisposition, containsContentId, containsContentType, containsFileName, containsHeader, containsHeaders, containsMsgref, containsSequenceId, containsSize, getContentDisposition, getContentId, getContentType, getFileName, getFirstHeader, getHeader, getHeader, getHeader, getHeaders, getHeadersIterator, getHeadersSize, getMatchingHeaders, getMsgref, getNonMatchingHeaders, getSequenceId, getSize, getSource, getSourceBytes, hasEnclosedParts, hasHeaders, removeContentDisposition, removeContentId, removeContentType, removeFileName, removeHeader, removeHeaders, removeMsgref, removeSequenceId, removeSize, setContentDisposition, setContentDisposition, setContentId, setContentType, setContentType, setFileName, setHeader, setMsgref, setSequenceId, setSize, writeTopublic java.lang.Object getContent()
throws com.openexchange.exception.OXException
MailPartmultipart/*getContent in class MailPartnull if not applicablecom.openexchange.exception.OXException - If content cannot be returned as a Java objectpublic javax.activation.DataHandler getDataHandler()
throws com.openexchange.exception.OXException
MailPartDataHandler for this mail part. multipart/*getDataHandler in class MailPartDataHandler or null if not applicablecom.openexchange.exception.OXException - If an appropriate DataHandler cannot be returnedpublic int getEnclosedCount()
throws com.openexchange.exception.OXException
MailPartmultipart/*getEnclosedCount in class MailPartMailPart.NO_ENCLOSED_PARTS if not applicablecom.openexchange.exception.OXExceptionMailPart.NO_ENCLOSED_PARTSpublic MailPart getEnclosedMailPart(int index) throws com.openexchange.exception.OXException
MailPartmultipart/*getEnclosedMailPart in class MailPartindex - The index of desired mail part or null if not applicablecom.openexchange.exception.OXExceptionpublic java.io.InputStream getInputStream()
throws com.openexchange.exception.OXException
MailPartmultipart/*getInputStream in class MailPartnull if not applicablecom.openexchange.exception.OXException - If no input stream could be returnedpublic void loadContent()
MailPartThis method is intended for mailing systems that read the contents stepwise on demand. If dealing with such a mail part with its underlying connection closed, the part's content is no more accessible. Otherwise this method may be implemented with an empty body.
Moreover the loaded content is no more discarded when MailPart.prepareForCaching() is invoked.
loadContent in class MailPartpublic void prepareForCaching()
MailPartprepareForCaching in class MailPartpublic java.lang.String getFileID()
null if content is kept inside rather than on disc.public boolean isMail()
true if referenced part is a mail; otherwise falsepublic ComposedMailPart.ComposedPartType getType()
getType in interface ComposedMailPartComposedMailPart.ComposedPartType enumeration type