public class MimeMessage extends Message implements MimePart
The string representation of RFC822 and MIME header fields must contain
only US-ASCII characters. Non US-ASCII characters must be encoded as per
the rules in RFC 2047. This class does not enforce those rules; the
caller is expected to use MimeUtility
to ensure that header
values are correctly encoded.
Modifier and Type | Class and Description |
---|---|
static class |
MimeMessage.RecipientType
Additional recipient types specific to internet messages.
|
Modifier and Type | Field and Description |
---|---|
protected java.lang.Object |
cachedContent
Cached return value from
getContent() . |
protected byte[] |
content
The bytes of the content of this message, if the message can be stored
in memory.
|
protected java.io.InputStream |
contentStream
A SharedInputStream containing the byte content of this message, if the
message cannot be stored in memory.
|
protected javax.activation.DataHandler |
dh
The data handler managing this message's content.
|
protected Flags |
flags
The message flags.
|
protected InternetHeaders |
headers
The message headers.
|
protected boolean |
modified
Indicates whether the message has been modified.
|
protected boolean |
saved
Indicates whether we do not need to call
saveChanges on
the message. |
ATTACHMENT, INLINE
Modifier | Constructor and Description |
---|---|
protected |
MimeMessage(Folder folder,
java.io.InputStream is,
int msgnum)
Constructor with a parent folder, message number, and RFC 822 input
stream.
|
protected |
MimeMessage(Folder folder,
int msgnum)
Constructor with a parent folder and message number.
|
protected |
MimeMessage(Folder folder,
InternetHeaders headers,
byte[] content,
int msgnum)
Constructor with a parent folder, message number, headers and byte
content.
|
|
MimeMessage(MimeMessage source)
Constructor with an existing message.
|
|
MimeMessage(Session session)
Constructor for an empty message.
|
|
MimeMessage(Session session,
java.io.InputStream is)
Constructor with an input stream contining an RFC 822 message.
|
Modifier and Type | Method and Description |
---|---|
void |
addFrom(Address[] addresses)
Adds the specified addresses to From header field.
|
void |
addHeader(java.lang.String name,
java.lang.String value)
Adds the specified header.
|
void |
addHeaderLine(java.lang.String line)
Adds an RFC 822 header-line to this message.
|
void |
addRecipients(Message.RecipientType type,
Address[] addresses)
Adds the given addresses to the recipients of the specified type.
|
void |
addRecipients(Message.RecipientType type,
java.lang.String addresses)
Adds the given addresses to the recipients of the specified type.
|
protected InternetHeaders |
createInternetHeaders(java.io.InputStream is)
Creates the headers from the given input stream.
|
protected MimeMessage |
createMimeMessage(Session session)
Creates a new MIME message.
|
java.util.Enumeration |
getAllHeaderLines()
Returns all the header-lines.
|
java.util.Enumeration |
getAllHeaders()
Returns all the headers.
|
Address[] |
getAllRecipients()
Returns all the recipients.
|
java.lang.Object |
getContent()
Returns this message's content as a Java object.
|
java.lang.String |
getContentID()
Returns the value of the Content-ID header field.
|
java.lang.String[] |
getContentLanguage()
Returns the languages specified in the Content-Language header field
of this message, as defined by RFC 1766.
|
java.lang.String |
getContentMD5()
Returns the value of the Content-MD5 header field.
|
protected java.io.InputStream |
getContentStream()
Returns the unencoded bytes of the content.
|
java.lang.String |
getContentType()
Returns the value of the RFC 822 Content-Type header field, or
"text/plain" if the header is not available.
|
javax.activation.DataHandler |
getDataHandler()
Returns a data handler for accessing this message's content.
|
java.lang.String |
getDescription()
Returns the Content-Description header field of this message.
|
java.lang.String |
getDisposition()
Returns the value of the RFC 822 Content-Disposition header field, or
null if the header is not available. |
java.lang.String |
getEncoding()
Returns the value of the Content-Transfer-Encoding header field.
|
java.lang.String |
getFileName()
Returns the filename associated with this message.
|
Flags |
getFlags()
Returns the flags for this message.
|
Address[] |
getFrom()
Returns the value of the RFC 822 From header field.
|
java.lang.String[] |
getHeader(java.lang.String name)
Returns all the values for the specified header name.
|
java.lang.String |
getHeader(java.lang.String name,
java.lang.String delimiter)
Returns all the values for the specified header name as a single
string, with headers separated by the given delimiter.
|
java.io.InputStream |
getInputStream()
Returns a decoded input stream for this message's content.
|
int |
getLineCount()
Returns the number of lines in the content of this message, or -1 if
this number cannot be determined.
|
java.util.Enumeration |
getMatchingHeaderLines(java.lang.String[] names)
Returns all the header-lines with any of the given names.
|
java.util.Enumeration |
getMatchingHeaders(java.lang.String[] names)
Returns all the headers with any of the given names.
|
java.lang.String |
getMessageID()
Returns the value of the Message-ID header field.
|
java.util.Enumeration |
getNonMatchingHeaderLines(java.lang.String[] names)
Returns all the header-lines without any of the given names.
|
java.util.Enumeration |
getNonMatchingHeaders(java.lang.String[] names)
Returns all the headers without any of the given names.
|
java.io.InputStream |
getRawInputStream()
Returns the unencoded bytes of the content without applying any content
transfer encoding.
|
java.util.Date |
getReceivedDate()
Returns the date on which this message was received.
|
Address[] |
getRecipients(Message.RecipientType type)
Returns the recipients of the given type.
|
Address[] |
getReplyTo()
Returns the value of the RFC 822 Reply-To header field.
|
Address |
getSender()
Returns the value of the RFC 822 Sender header field.
|
java.util.Date |
getSentDate()
Returns the value of the RFC 822 Date field.
|
int |
getSize()
Returns the size of the content of this message in bytes, or -1 if the
size cannot be determined.
|
java.lang.String |
getSubject()
Returns the value of the Subject header field.
|
boolean |
isMimeType(java.lang.String mimeType)
Indicates whether this message is of the specified MIME type.
|
boolean |
isSet(Flags.Flag flag)
Indicates whether the specified flag is set in this message.
|
protected void |
parse(java.io.InputStream is)
Parses the given input stream, setting the headers and content fields
appropriately.
|
void |
removeHeader(java.lang.String name)
Removes all headers with the specified name.
|
Message |
reply(boolean replyToAll)
Returns a new message suitable for a reply to this message.
|
Message |
reply(boolean replyToAll,
boolean setAnswered)
Returns a new message suitable for a reply to this message.
|
void |
saveChanges()
Saves any changes to this message.
|
void |
setContent(Multipart mp)
Sets the content of this message to be the specified multipart.
|
void |
setContent(java.lang.Object o,
java.lang.String type)
Sets the content of this message using the specified Java object and
MIME type.
|
void |
setContentID(java.lang.String cid)
Sets the Content-ID header field of this message.
|
void |
setContentLanguage(java.lang.String[] languages)
Sets the Content-Language header of this message.
|
void |
setContentMD5(java.lang.String md5)
Sets the Content-MD5 header field of this message.
|
void |
setDataHandler(javax.activation.DataHandler datahandler)
Sets the content of this part using the specified data handler.
|
void |
setDescription(java.lang.String description)
Sets the Content-Description header field for this message.
|
void |
setDescription(java.lang.String description,
java.lang.String charset)
Sets the Content-Description header field for this message.
|
void |
setDisposition(java.lang.String disposition)
Sets the Content-Disposition header field of this message.
|
void |
setFileName(java.lang.String filename)
Sets the filename associated with this part.
|
void |
setFlags(Flags flag,
boolean set)
Sets the flags for this message.
|
void |
setFrom()
Sets the RFC 822 From header field using the value of the
InternetAddress.getLocalAddress method. |
void |
setFrom(Address address)
Sets the RFC 822 From header field.
|
void |
setFrom(java.lang.String address)
Utility method to set the From header field using a String.
|
void |
setHeader(java.lang.String name,
java.lang.String value)
Sets the specified header.
|
void |
setRecipients(Message.RecipientType type,
Address[] addresses)
Sets the recipients of the given type.
|
void |
setRecipients(Message.RecipientType type,
java.lang.String addresses)
Sets the recipients of the given type.
|
void |
setReplyTo(Address[] addresses)
Sets the RFC 822 Reply-To header field.
|
void |
setSender(Address address)
Sets the RFC 822 Sender header field.
|
void |
setSentDate(java.util.Date date)
Sets the RFC 822 Date header field.
|
void |
setSubject(java.lang.String subject)
Sets the Subject header field.
|
void |
setSubject(java.lang.String subject,
java.lang.String charset)
Sets the Subject header field.
|
void |
setText(java.lang.String text)
Sets the content of this message using the specified text, and with a
MIME type of "text/plain".
|
void |
setText(java.lang.String text,
java.lang.String charset)
Sets the content of this message using the specified text, and with a
MIME type of "text/plain".
|
void |
setText(java.lang.String text,
java.lang.String charset,
java.lang.String subtype)
Sets the content of this message using the specified text, and with a
text MIME type of the specified subtype.
|
protected void |
updateHeaders()
Updates the headers of this part, based on the content.
|
protected void |
updateMessageId()
Updates the Message-ID header.
|
void |
writeTo(java.io.OutputStream os)
Writes this message to the specified stream in RFC 822 format.
|
void |
writeTo(java.io.OutputStream os,
java.lang.String[] ignoreList)
Writes this message to the specified stream in RFC 822 format, without
the specified headers.
|
addRecipient, getFolder, getMessageNumber, getSession, isExpunged, match, setExpunged, setFlag, setMessageNumber, setRecipient
protected javax.activation.DataHandler dh
protected byte[] content
protected java.io.InputStream contentStream
protected InternetHeaders headers
protected Flags flags
protected boolean modified
writeTo
method.
This field is set to true when an empty message is created or when the
saveChanges
method is called.protected boolean saved
saveChanges
on
the message.
This flag is set to false by the public constructor and set to true
by the saveChanges
method.
The writeTo
method checks this flag and calls the
saveChanges
method as necessary.protected java.lang.Object cachedContent
getContent()
.
This field is cleared by getDataHandler()
.public MimeMessage(Session session)
public MimeMessage(Session session, java.io.InputStream is) throws MessagingException
session
- the session contextis
- the message input streamMessagingException
public MimeMessage(MimeMessage source) throws MessagingException
source
- the message to copyMessagingException
protected MimeMessage(Folder folder, int msgnum)
folder
- the parent foldermsgnum
- the message numberprotected MimeMessage(Folder folder, java.io.InputStream is, int msgnum) throws MessagingException
folder
- the parent folderis
- the message input streammsgnum
- the message number of this message within the folderMessagingException
protected MimeMessage(Folder folder, InternetHeaders headers, byte[] content, int msgnum) throws MessagingException
folder
- the parent folderheaders
- the headerscontent
- the content byte arraymsgnum
- the message number of this message within the folderMessagingException
protected void parse(java.io.InputStream is) throws MessagingException
modified
flag.is
- the message input streamMessagingException
public Address[] getFrom() throws MessagingException
getFrom
in class Message
MessagingException
public void setFrom(Address address) throws MessagingException
setFrom
in class Message
address
- the sender of this messageIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public void setFrom() throws MessagingException
InternetAddress.getLocalAddress
method.setFrom
in class Message
IllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public void setFrom(java.lang.String address) throws MessagingException
address
- the message senderIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public void addFrom(Address[] addresses) throws MessagingException
addFrom
in class Message
addresses
- the senders of this messageIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public Address getSender() throws MessagingException
MessagingException
public void setSender(Address address) throws MessagingException
address
- the sender of this messageIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public Address[] getRecipients(Message.RecipientType type) throws MessagingException
getRecipients
in class Message
type
- the recipient typeMessagingException
public Address[] getAllRecipients() throws MessagingException
getAllRecipients
in class Message
MessagingException
public void setRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException
setRecipients
in class Message
type
- the recipient typeaddresses
- the addresses, or null to remove recipients of this
typeIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public void setRecipients(Message.RecipientType type, java.lang.String addresses) throws MessagingException
type
- the recipient typeaddresses
- the addresses, or null to remove recpients of this
typeIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public void addRecipients(Message.RecipientType type, Address[] addresses) throws MessagingException
addRecipients
in class Message
type
- the recipient typeaddresses
- the addressesIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public void addRecipients(Message.RecipientType type, java.lang.String addresses) throws MessagingException
type
- the recipient typeaddresses
- the addressesIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public Address[] getReplyTo() throws MessagingException
getFrom
method
is returned.getReplyTo
in class Message
MessagingException
public void setReplyTo(Address[] addresses) throws MessagingException
setReplyTo
in class Message
addresses
- the addresses, or null
to remove this
headerIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public java.lang.String getSubject() throws MessagingException
If the subject is encoded as per RFC 2047, it is decoded and converted into Unicode.
getSubject
in class Message
MessagingException
public void setSubject(java.lang.String subject) throws MessagingException
If the subject contains non US-ASCII characters, it will be encoded using the platform default charset.
setSubject
in class Message
subject
- the subjectIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public void setSubject(java.lang.String subject, java.lang.String charset) throws MessagingException
If the subject contains non US-ASCII characters, it will be encoded using the specified charset.
subject
- the subjectcharset
- the charset used for any encodingIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public java.util.Date getSentDate() throws MessagingException
getSentDate
in class Message
MessagingException
public void setSentDate(java.util.Date date) throws MessagingException
setSentDate
in class Message
date
- the sent date, or null
to remove this headerIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public java.util.Date getReceivedDate() throws MessagingException
getReceivedDate
in class Message
MessagingException
public int getSize() throws MessagingException
Note that this number may not be an exact measure, but if not -1, it will be suitable for display to the user.
getSize
in interface Part
MessagingException
public int getLineCount() throws MessagingException
Note that this number may not be an exact measure, but if not -1, it will be suitable for display to the user.
getLineCount
in interface Part
MessagingException
public java.lang.String getContentType() throws MessagingException
getContentType
in interface Part
MessagingException
public boolean isMimeType(java.lang.String mimeType) throws MessagingException
If the subtype of mimeType
is the special character '*',
the subtype is ignored during the comparison.
isMimeType
in interface Part
MessagingException
MimeBodyPart.isMimeType(java.lang.String)
public java.lang.String getDisposition() throws MessagingException
null
if the header is not available.getDisposition
in interface Part
MessagingException
MimeBodyPart.getDisposition()
public void setDisposition(java.lang.String disposition) throws MessagingException
setDisposition
in interface Part
disposition
- the disposition value to set, or null to removeIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
MimeBodyPart.setDisposition(java.lang.String)
public java.lang.String getEncoding() throws MessagingException
getEncoding
in interface MimePart
MessagingException
MimeBodyPart.getEncoding()
public java.lang.String getContentID() throws MessagingException
getContentID
in interface MimePart
MessagingException
MimeBodyPart.getContentID()
public void setContentID(java.lang.String cid) throws MessagingException
IllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public java.lang.String getContentMD5() throws MessagingException
getContentMD5
in interface MimePart
MessagingException
MimeBodyPart.getContentMD5()
public void setContentMD5(java.lang.String md5) throws MessagingException
setContentMD5
in interface MimePart
IllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
MimeBodyPart.setContentMD5(java.lang.String)
public java.lang.String getDescription() throws MessagingException
If the Content-Description field is encoded as per RFC 2047, it is decoded and converted into Unicode.
getDescription
in interface Part
MessagingException
MimeBodyPart.getDescription()
public void setDescription(java.lang.String description) throws MessagingException
If the description contains non US-ASCII characters, it will be encoded using the platform default charset.
setDescription
in interface Part
description
- the content descriptionIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
MimeBodyPart.setDescription(java.lang.String)
public void setDescription(java.lang.String description, java.lang.String charset) throws MessagingException
If the description contains non US-ASCII characters, it will be encoded using the specified charset.
description
- the content descriptioncharset
- the charset used for any encodingIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
MimeBodyPart.setDescription(java.lang.String)
public java.lang.String[] getContentLanguage() throws MessagingException
null
if this header is not available.getContentLanguage
in interface MimePart
MessagingException
MimeBodyPart.getContentLanguage()
public void setContentLanguage(java.lang.String[] languages) throws MessagingException
setContentLanguage
in interface MimePart
languages
- the array of language tagsIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
MimeBodyPart.setContentLanguage(java.lang.String[])
public java.lang.String getMessageID() throws MessagingException
MessagingException
public java.lang.String getFileName() throws MessagingException
This method returns the value of the "filename" parameter from the Content-Disposition header field of this message. If the latter is not available, it returns the value of the "name" parameter from the Content-Type header field.
getFileName
in interface Part
MessagingException
MimeBodyPart.getFileName()
public void setFileName(java.lang.String filename) throws MessagingException
setFileName
in interface Part
filename
- the filename to associate with this partIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
MimeBodyPart.setFileName(java.lang.String)
public java.io.InputStream getInputStream() throws java.io.IOException, MessagingException
getInputStream
in interface Part
java.io.IOException
- if an error occurs in the data handler layerMessagingException
MimeBodyPart.getInputStream()
protected java.io.InputStream getContentStream() throws MessagingException
MessagingException
MimeBodyPart.getContentStream()
public java.io.InputStream getRawInputStream() throws MessagingException
MessagingException
MimeBodyPart.getRawInputStream()
public javax.activation.DataHandler getDataHandler() throws MessagingException
getDataHandler
in interface Part
MessagingException
public java.lang.Object getContent() throws java.io.IOException, MessagingException
getContent
in interface Part
java.io.IOException
- if an error occurred in the data handler layerMessagingException
public void setDataHandler(javax.activation.DataHandler datahandler) throws MessagingException
setDataHandler
in interface Part
datahandler
- the data handler for the contentIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
MimeBodyPart.setDataHandler(javax.activation.DataHandler)
public void setContent(java.lang.Object o, java.lang.String type) throws MessagingException
setContent
in interface Part
o
- the content objecttype
- the MIME type of the objectIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
MimeBodyPart.setContent(java.lang.Object, java.lang.String)
public void setText(java.lang.String text) throws MessagingException
If the string contains non US-ASCII characters, it will be encoded using the platform default charset.
setText
in interface MimePart
setText
in interface Part
text
- the text contentIllegalWriteException
- if the underlying implementation
does not support modificationMessagingException
MimeBodyPart.setText(String)
public void setText(java.lang.String text, java.lang.String charset) throws MessagingException
If the string contains non US-ASCII characters, it will be encoded using the specified charset.
setText
in interface MimePart
text
- the text contentcharset
- the charset used for any encodingMessagingException
MimeBodyPart.setText(String,String)
public void setText(java.lang.String text, java.lang.String charset, java.lang.String subtype) throws MessagingException
If the string contains non US-ASCII characters, it will be encoded using the specified charset.
setText
in interface MimePart
text
- the text contentcharset
- the charset used for any encodingsubtype
- the MIME text subtype (e.g. "plain", "html")MessagingException
MimeBodyPart.setText(String,String,String)
public void setContent(Multipart mp) throws MessagingException
setContent
in interface Part
mp
- the multipart contentIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
MimeBodyPart.setContent(Multipart)
public Message reply(boolean replyToAll) throws MessagingException
reply
in class Message
replyToAll
- the reply should be sent to all the recipients of
this messageMessagingException
public Message reply(boolean replyToAll, boolean setAnswered) throws MessagingException
replyToAll
- the reply should be sent to all the recipients of
this messagesetAnswered
- if true, sets the ANSWERED flag in this messageMessagingException
public void writeTo(java.io.OutputStream os) throws java.io.IOException, MessagingException
writeTo
in interface Part
java.io.IOException
- if an error occurs writing to the stream or in
the data handler layerMessagingException
- if an error occurs fetching the data
to be writtenpublic void writeTo(java.io.OutputStream os, java.lang.String[] ignoreList) throws java.io.IOException, MessagingException
java.io.IOException
- if an error occurs writing to the stream or in
the data handler layerMessagingException
public java.lang.String[] getHeader(java.lang.String name) throws MessagingException
getHeader
in interface Part
name
- the header nameMessagingException
public java.lang.String getHeader(java.lang.String name, java.lang.String delimiter) throws MessagingException
null
, only the first header is
returned.getHeader
in interface MimePart
name
- the header namedelimiter
- the delimiterMessagingException
public void setHeader(java.lang.String name, java.lang.String value) throws MessagingException
setHeader
in interface Part
name
- the header namevalue
- the header valueIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public void addHeader(java.lang.String name, java.lang.String value) throws MessagingException
addHeader
in interface Part
name
- the header namevalue
- the header valueIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public void removeHeader(java.lang.String name) throws MessagingException
removeHeader
in interface Part
name
- the header nameIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public java.util.Enumeration getAllHeaders() throws MessagingException
getAllHeaders
in interface Part
MessagingException
public java.util.Enumeration getMatchingHeaders(java.lang.String[] names) throws MessagingException
getMatchingHeaders
in interface Part
names
- the header names to matchMessagingException
public java.util.Enumeration getNonMatchingHeaders(java.lang.String[] names) throws MessagingException
getNonMatchingHeaders
in interface Part
names
- the header names to ignoreMessagingException
public void addHeaderLine(java.lang.String line) throws MessagingException
addHeaderLine
in interface MimePart
IllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public java.util.Enumeration getAllHeaderLines() throws MessagingException
getAllHeaderLines
in interface MimePart
MessagingException
public java.util.Enumeration getMatchingHeaderLines(java.lang.String[] names) throws MessagingException
getMatchingHeaderLines
in interface MimePart
MessagingException
public java.util.Enumeration getNonMatchingHeaderLines(java.lang.String[] names) throws MessagingException
getNonMatchingHeaderLines
in interface MimePart
MessagingException
public Flags getFlags() throws MessagingException
getFlags
in class Message
MessagingException
public boolean isSet(Flags.Flag flag) throws MessagingException
isSet
in class Message
flag
- the flagMessagingException
public void setFlags(Flags flag, boolean set) throws MessagingException
setFlags
in class Message
flag
- the flags to be setset
- the value to be setIllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
public void saveChanges() throws MessagingException
saveChanges
in class Message
IllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
protected void updateHeaders() throws MessagingException
IllegalWriteException
- if the underlying implementation
does not support modification of existing valuesjava.lang.IllegalStateException
- if this message is obtained from
a READ_ONLY folderMessagingException
MimeBodyPart.updateHeaders()
protected InternetHeaders createInternetHeaders(java.io.InputStream is) throws MessagingException
is
- the input stream to read the headers fromMessagingException
protected void updateMessageId() throws MessagingException
updateHeaders
, and should set the Message-Id header to a
suitably unique value if overridden.MessagingException
protected MimeMessage createMimeMessage(Session session) throws MessagingException
reply
method to determine the MimeMessage
subclass, if any, to use.MessagingException