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 fields must 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.
Callers of the setHeader, addHeader, and
addHeaderLine methods are responsible for enforcing
the MIME requirements for the specified headers. In addition, these
header fields must be folded (wrapped) before being sent if they
exceed the line length limitation for the transport (1000 bytes for
SMTP). Received headers may have been folded. The application is
responsible for folding and unfolding headers as appropriate.
MimeUtility, javax.mail.Part
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public Enumeration | Returns: an Enumeration of StringsGet all header lines as an Enumeration of Strings. |
| public String | |
| public String[] | Returns: array of content language stringsGet the language tags specified in the Content-Language header of this MimePart. |
| public String | |
| public String | |
| public String | |
| public Enumeration | Returns: an Enumeration of Stringsthe headers to return names)Get matching header lines as an Enumeration of Strings. |
| public Enumeration | Returns: an Enumeration of Stringsthe headers to not return names)Get non-matching header lines as an Enumeration of Strings. |
| public void | setContentLanguage(String[]
array of language tags languages)Set the Content-Language header of this MimePart. |
| public void | |
| public void | setText(String
the text content to set text)Redeclares javax. |
| public void | |
| public void |
| addHeaderLine | back to summary |
|---|---|
| public void addHeaderLine(String line) throws MessagingException Add a raw RFC822 header-line.
| |
| getAllHeaderLines | back to summary |
|---|---|
| public Enumeration Get all header lines as an Enumeration of Strings. A Header line is a raw RFC822 header-line, containing both the "name" and "value" field.
| |
| getContentID | back to summary |
|---|---|
| public String getContentID() throws MessagingException Get the Content-ID of this part. Returns null if none present.
| |
| getContentLanguage | back to summary |
|---|---|
| public String[] getContentLanguage() throws MessagingException Get the language tags specified in the Content-Language header
of this MimePart. The Content-Language header is defined by
RFC 1766. Returns
| |
| getContentMD5 | back to summary |
|---|---|
| public String getContentMD5() throws MessagingException Get the Content-MD5 digest of this part. Returns null if none present.
| |
| getEncoding | back to summary |
|---|---|
| public String getEncoding() throws MessagingException Get the transfer encoding of this part.
| |
| getHeader | back to summary |
|---|---|
| public String getHeader(String name, String delimiter) throws MessagingException Get the values of all header fields available for this header,
returned as a single String, with the values separated by the
delimiter. If the delimiter is
| |
| getMatchingHeaderLines | back to summary |
|---|---|
| public Enumeration Get matching header lines as an Enumeration of Strings. A Header line is a raw RFC822 header-line, containing both the "name" and "value" field.
| |
| getNonMatchingHeaderLines | back to summary |
|---|---|
| public Enumeration Get non-matching header lines as an Enumeration of Strings. A Header line is a raw RFC822 header-line, containing both the "name" and "value" field.
| |
| setContentLanguage | back to summary |
|---|---|
| public void setContentLanguage(String[] languages) throws MessagingException Set the Content-Language header of this MimePart. The Content-Language header is defined by RFC1766.
| |
| setContentMD5 | back to summary |
|---|---|
| public void setContentMD5(String md5) throws MessagingException Set the Content-MD5 of this part.
| |
| setText | back to summary |
|---|---|
| public void setText(String text) throws MessagingException Redeclares javax. Convenience method that sets the given String as this part's content, with a MIME type of "text/plain". If the string contains non US-ASCII characters. it will be encoded using the platform's default charset. The charset is also used to set the "charset" parameter.
Note that there may be a performance penalty if
If the charset is already known, use the
| |
| setText | back to summary |
|---|---|
| public void setText(String text, String charset) throws MessagingException Convenience method that sets the given String as this part's content, with a MIME type of "text/plain" and the specified charset. The given Unicode string will be charset-encoded using the specified charset. The charset is also used to set "charset" parameter.
| |
| setText | back to summary |
|---|---|
| public void setText(String text, String charset, String subtype) throws MessagingException Convenience method that sets the given String as this part's content, with a primary MIME type of "text" and the specified MIME subtype. The given Unicode string will be charset-encoded using the specified charset. The charset is also used to set the "charset" parameter.
| |