public final class MimeMailPart extends MailPart implements MimeRawSource, MimeCleanUp
MimeMailPart - Represents a MIME part as per RFC 822.NO_ENCLOSED_PARTS| Constructor and Description |
|---|
MimeMailPart()
Constructor.
|
MimeMailPart(javax.mail.Multipart multipart)
Initializes a new
MimeMailPart. |
MimeMailPart(javax.mail.Part part)
Constructor - Only applies specified part, but does not set any attributes.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cleanUp()
Performs the clean-up on this MIME resources.
|
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.io.InputStream |
getInputStream()
Returns an input stream for this part.
|
javax.mail.Part |
getPart()
Gets the
part. |
java.io.InputStream |
getRawInputStream()
Gets an
InputStream to the raw data with any Content-Transfer-Encoding intact. |
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
|
void |
setContent(javax.mail.Part part)
Sets this mail part's content.
|
void |
setHandleMissingStartBoundary(boolean handleMissingStartBoundary)
Set whether to handle "Missing start boundary"
javax.mail.MessagingException. |
void |
writeTo(java.io.OutputStream out)
Writes complete part's data into given output stream
|
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, setSizepublic MimeMailPart()
public MimeMailPart(javax.mail.Part part)
throws com.openexchange.exception.OXException
com.openexchange.exception.OXException - If setting part as content failspublic MimeMailPart(javax.mail.Multipart multipart)
throws com.openexchange.exception.OXException
MimeMailPart.multipart - The multipartcom.openexchange.exception.OXException - If setting multipart as content failspublic void setHandleMissingStartBoundary(boolean handleMissingStartBoundary)
javax.mail.MessagingException.
Note: Set only to true if JavaMail property "mail.mime.multipart.allowempty" is set to
"false".
handleMissingStartBoundary - true to handle "Missing start boundary" error; otherwise falsepublic void setContent(javax.mail.Part part)
throws com.openexchange.exception.OXException
part - The partcom.openexchange.exception.OXException - If part cannot be applied to this MIME mail partpublic javax.mail.Part getPart()
part.getPart in interface MimeRawSourcepart or nullpublic void cleanUp()
MimeCleanUpcleanUp in interface MimeCleanUppublic 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 java.io.InputStream getRawInputStream()
throws com.openexchange.exception.OXException
MimeRawSourceInputStream to the raw data with any Content-Transfer-Encoding intact. This method is useful if the
"Content-Transfer-Encoding" header is incorrect or corrupt. In such a case the application may use this method and attempt to decode
the raw data itself.getRawInputStream in interface MimeRawSourcecom.openexchange.exception.OXException - If an error occurspublic 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 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 int getEnclosedCount()
throws com.openexchange.exception.OXException
MailPartmultipart/*getEnclosedCount in class MailPartMailPart.NO_ENCLOSED_PARTS if not applicablecom.openexchange.exception.OXExceptionMailPart.NO_ENCLOSED_PARTSpublic void writeTo(java.io.OutputStream out)
throws com.openexchange.exception.OXException
MailPartpublic void prepareForCaching()
MailPartprepareForCaching in class MailPartpublic void loadContent()
throws com.openexchange.exception.OXException
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 MailPartcom.openexchange.exception.OXException - If loading part's content fails