The MimePart interface models anEntity as defined by MIME (RFC2045, Section 2.4).
MimePart extends the Part interface to add additional RFC822 and MIME specific semantics and attributes. It provides the base interface for the MimeMessage and MimeBodyPart classes
RFC822 and MIME header fieldsmust contain only US-ASCII characters. If a header contains non US-ASCII characters, it must be encoded as per the rules in RFC 2047. The MimeUtility class provided in this package can be used to to achieve this.
MimeUtility
,Part
Fields inherited from interface javax.mail.Part |
ATTACHMENT,INLINE |
addHeaderLine(java.lang.String line) Add a raw RFC822 header-line. | |
getAllHeaderLines() Get all header lines as an Enumeration of Strings. | |
getContentID() Get the Content-ID of this part. | |
getContentLanguage() Get the language tags specified in the Content-Language header of this MimePart. | |
getContentMD5() Get the Content-MD5 digest of this part. | |
getEncoding() Get the transfer encoding of this part. | |
getHeader(java.lang.String header_name, java.lang.String delimiter) Get the values of all header fields available for this header, returned as a single String, with the values separated by the delimiter. | |
getMatchingHeaderLines(java.lang.String[] names) Get matching header lines as an Enumeration of Strings. | |
getNonMatchingHeaderLines(java.lang.String[] names) Get non-matching header lines as an Enumeration of Strings. | |
setContentLanguage(java.lang.String[] languages) Set the Content-Language header of this MimePart. | |
setContentMD5(java.lang.String md5) Set the Content-MD5 of this part. | |
setText(java.lang.String text) Convenience method that sets the given String as this part's content, with a MIME type of "text/plain". | |
setText(java.lang.String text, java.lang.String charset) Convenience method that sets the given String as this part's content, with a MIME type of "text/plain" and the specified charset. |
public java.lang.StringgetHeader(java.lang.String header_name, java.lang.String delimiter) throwsMessagingException
null
, only the first value is returned.header_name
- the name of this headerMessagingException
- public voidaddHeaderLine(java.lang.String line) throwsMessagingException
IllegalWriteException
- if the underlyingimplementation does not support modificationjava.lang.IllegalStateException
- if this Part isobtained from a READ_ONLY folderpublic java.util.EnumerationgetAllHeaderLines() throwsMessagingException
public java.util.EnumerationgetMatchingHeaderLines(java.lang.String[] names) throwsMessagingException
public java.util.EnumerationgetNonMatchingHeaderLines(java.lang.String[] names) throwsMessagingException
public java.lang.StringgetEncoding() throwsMessagingException
MessagingException
- public java.lang.StringgetContentID() throwsMessagingException
public java.lang.StringgetContentMD5() throwsMessagingException
public voidsetContentMD5(java.lang.String md5) throwsMessagingException
cid
- content-idIllegalWriteException
- if the underlyingimplementation does not support modificationjava.lang.IllegalStateException
- if this Part isobtained from a READ_ONLY folderpublic java.lang.String[]getContentLanguage() throwsMessagingException
null
if this header is not available.public voidsetContentLanguage(java.lang.String[] languages) throwsMessagingException
languages
- array of language tagsIllegalWriteException
- if the underlyingimplementation does not support modificationjava.lang.IllegalStateException
- if this Part isobtained from a READ_ONLY folderpublic voidsetText(java.lang.String text) throwsMessagingException
Note that there may be a performance penalty iftext
is large, since this method may have to scan all the characters to determine what charset to use.
If the charset is already known, use the setText() version that takes the charset parameter.
setText
in interfacePart
setText(String text, String charset)
public voidsetText(java.lang.String text, java.lang.String charset) throwsMessagingException