|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.mail.Message
javax.mail.internet.MimeMessage
com.sun.mail.imap.IMAPMessage
public class IMAPMessage
This class implements an IMAPMessage object.
An IMAPMessage object starts out as a light-weight object. It gets filled-in incrementally when a request is made for some item. Or when a prefetch is done using the FetchProfile.
An IMAPMessage has a messageNumber and a sequenceNumber. The messageNumber is its index into its containing folder's messageCache. The sequenceNumber is its IMAP sequence-number.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.mail.internet.MimeMessage |
---|
javax.mail.internet.MimeMessage.RecipientType |
Field Summary | |
---|---|
protected BODYSTRUCTURE |
bs
|
protected ENVELOPE |
envelope
|
protected java.lang.String |
sectionId
|
Fields inherited from class javax.mail.internet.MimeMessage |
---|
content, contentStream, dh, flags, headers, modified, saved |
Fields inherited from class javax.mail.Message |
---|
expunged, folder, msgnum, session |
Fields inherited from interface javax.mail.Part |
---|
ATTACHMENT, INLINE |
Constructor Summary | |
---|---|
protected |
IMAPMessage(IMAPFolder folder,
int msgnum,
int seqnum)
Constructor. |
protected |
IMAPMessage(javax.mail.Session session)
Constructor, for use by IMAPNestedMessage. |
Method Summary | |
---|---|
void |
addFrom(javax.mail.Address[] addresses)
Add the specified addresses to the existing "From" field. |
void |
addHeader(java.lang.String name,
java.lang.String value)
Add this value to the existing values for this header_name. |
void |
addHeaderLine(java.lang.String line)
Add a raw RFC 822 header-line. |
void |
addRecipients(javax.mail.Message.RecipientType type,
javax.mail.Address[] addresses)
Add the given addresses to the specified recipient type. |
protected void |
checkExpunged()
|
protected void |
forceCheckExpunged()
Do a NOOP to force any untagged EXPUNGE responses and then check if this message is expunged. |
java.util.Enumeration |
getAllHeaderLines()
Get all header-lines. |
java.util.Enumeration |
getAllHeaders()
Get all headers. |
java.lang.String |
getContentID()
Get the Content-ID. |
java.lang.String[] |
getContentLanguage()
Get the content language. |
java.lang.String |
getContentMD5()
Get the Content-MD5. |
protected java.io.InputStream |
getContentStream()
Get all the bytes for this message. |
java.lang.String |
getContentType()
Get the Content-Type. |
javax.activation.DataHandler |
getDataHandler()
Get the DataHandler object for this message. |
java.lang.String |
getDescription()
Get the decoded Content-Description. |
java.lang.String |
getDisposition()
Get the Content-Disposition. |
java.lang.String |
getEncoding()
Get the Content-Transfer-Encoding. |
protected int |
getFetchBlockSize()
|
java.lang.String |
getFileName()
Get the "filename" Disposition parameter. |
javax.mail.Flags |
getFlags()
Get the Flags for this message. |
javax.mail.Address[] |
getFrom()
Get the "From" attribute. |
java.lang.String[] |
getHeader(java.lang.String name)
Get the named header. |
java.lang.String |
getHeader(java.lang.String name,
java.lang.String delimiter)
Get the named header. |
java.lang.String |
getInReplyTo()
Get the In-Reply-To header. |
int |
getLineCount()
Get the total number of lines. |
java.util.Enumeration |
getMatchingHeaderLines(java.lang.String[] names)
Get all matching header-lines. |
java.util.Enumeration |
getMatchingHeaders(java.lang.String[] names)
Get matching headers. |
protected java.lang.Object |
getMessageCacheLock()
Get the messageCacheLock, associated with this Message's Folder. |
java.lang.String |
getMessageID()
Get the Message-ID. |
java.util.Enumeration |
getNonMatchingHeaderLines(java.lang.String[] names)
Get all non-matching headerlines. |
java.util.Enumeration |
getNonMatchingHeaders(java.lang.String[] names)
Get non-matching headers. |
boolean |
getPeek()
Get whether or not to use the PEEK variant of FETCH when fetching message content. |
protected IMAPProtocol |
getProtocol()
Get this message's folder's protocol connection. |
java.util.Date |
getReceivedDate()
Get the recieved date (INTERNALDATE) |
javax.mail.Address[] |
getRecipients(javax.mail.Message.RecipientType type)
Get the desired Recipient type. |
javax.mail.Address[] |
getReplyTo()
Get the ReplyTo addresses. |
javax.mail.Address |
getSender()
Get the "Sender" attribute. |
java.util.Date |
getSentDate()
Get the SentDate. |
protected int |
getSequenceNumber()
Get this message's IMAP sequence number. |
int |
getSize()
Get the message size. |
java.lang.String |
getSubject()
Get the decoded subject. |
protected long |
getUID()
|
void |
invalidateHeaders()
Invalidate cached header and envelope information for this message. |
protected boolean |
isREV1()
|
boolean |
isSet(javax.mail.Flags.Flag flag)
Test if the given Flags are set in this message. |
void |
removeHeader(java.lang.String name)
Remove all headers with this name. |
void |
setContentID(java.lang.String cid)
Set the "Content-ID" header field of this Message. |
void |
setContentLanguage(java.lang.String[] languages)
Set the "Content-Language" header of this MimePart. |
void |
setContentMD5(java.lang.String md5)
Set the "Content-MD5" header field of this Message. |
void |
setDataHandler(javax.activation.DataHandler content)
This method provides the mechanism to set this part's content. |
void |
setDescription(java.lang.String description,
java.lang.String charset)
Set the "Content-Description" header field for this Message. |
void |
setDisposition(java.lang.String disposition)
Set the "Content-Disposition" header field of this Message. |
protected void |
setExpunged(boolean set)
Sets the expunged flag for this Message. |
void |
setFileName(java.lang.String filename)
Set the filename associated with this part, if possible. |
void |
setFlags(javax.mail.Flags flag,
boolean set)
Set/Unset the given flags in this message. |
void |
setFrom(javax.mail.Address address)
Set the RFC 822 "From" header field. |
void |
setHeader(java.lang.String name,
java.lang.String value)
Set the value for this header_name. |
protected void |
setMessageNumber(int msgnum)
Wrapper around the protected method Message.setMessageNumber() to make that method accessible to IMAPFolder. |
void |
setPeek(boolean peek)
Set whether or not to use the PEEK variant of FETCH when fetching message content. |
void |
setRecipients(javax.mail.Message.RecipientType type,
javax.mail.Address[] addresses)
Set the specified recipient type to the given addresses. |
void |
setReplyTo(javax.mail.Address[] addresses)
Set the RFC 822 "Reply-To" header field. |
void |
setSender(javax.mail.Address address)
Set the RFC 822 "Sender" header field. |
void |
setSentDate(java.util.Date d)
Set the RFC 822 "Date" header field. |
protected void |
setSequenceNumber(int seqnum)
Set this message's IMAP sequence number. |
void |
setSubject(java.lang.String subject,
java.lang.String charset)
Set the "Subject" header field. |
protected void |
setUID(long uid)
|
void |
writeTo(java.io.OutputStream os)
Write out the bytes into the given outputstream. |
Methods inherited from class javax.mail.internet.MimeMessage |
---|
addRecipients, createInternetHeaders, createMimeMessage, getAllRecipients, getContent, getInputStream, getRawInputStream, isMimeType, parse, reply, saveChanges, setContent, setContent, setDescription, setFrom, setRecipients, setSubject, setText, setText, setText, updateHeaders, updateMessageID, writeTo |
Methods inherited from class javax.mail.Message |
---|
addRecipient, getFolder, getMessageNumber, isExpunged, match, setFlag, setRecipient |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected BODYSTRUCTURE bs
protected ENVELOPE envelope
protected java.lang.String sectionId
Constructor Detail |
---|
protected IMAPMessage(IMAPFolder folder, int msgnum, int seqnum)
protected IMAPMessage(javax.mail.Session session)
Method Detail |
---|
protected IMAPProtocol getProtocol() throws ProtocolException, javax.mail.FolderClosedException
ProtocolException
javax.mail.FolderClosedException
protected boolean isREV1() throws javax.mail.FolderClosedException
javax.mail.FolderClosedException
protected java.lang.Object getMessageCacheLock()
protected int getSequenceNumber()
protected void setSequenceNumber(int seqnum)
protected void setMessageNumber(int msgnum)
setMessageNumber
in class javax.mail.Message
protected long getUID()
protected void setUID(long uid)
protected void setExpunged(boolean set)
javax.mail.Message
setExpunged
in class javax.mail.Message
set
- the expunged flagprotected void checkExpunged() throws javax.mail.MessageRemovedException
javax.mail.MessageRemovedException
protected void forceCheckExpunged() throws javax.mail.MessageRemovedException, javax.mail.FolderClosedException
javax.mail.MessageRemovedException
javax.mail.FolderClosedException
protected int getFetchBlockSize()
public javax.mail.Address[] getFrom() throws javax.mail.MessagingException
getFrom
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.headers
public void setFrom(javax.mail.Address address) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
null
,
this header is removed.
setFrom
in class javax.mail.internet.MimeMessage
address
- the sender of this message
javax.mail.MessagingException
public void addFrom(javax.mail.Address[] addresses) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
addFrom
in class javax.mail.internet.MimeMessage
addresses
- the senders of this message
javax.mail.MessagingException
public javax.mail.Address getSender() throws javax.mail.MessagingException
getSender
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.headers
public void setSender(javax.mail.Address address) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
null
,
this header is removed.
setSender
in class javax.mail.internet.MimeMessage
address
- the sender of this message
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
of existing values
javax.mail.MessagingException
public javax.mail.Address[] getRecipients(javax.mail.Message.RecipientType type) throws javax.mail.MessagingException
getRecipients
in class javax.mail.internet.MimeMessage
type
- Type of recepient
javax.mail.MessagingException
- if header could not
be retrieved
javax.mail.internet.AddressException
- if the header is misformattedMimeMessage.headers
,
Message.RecipientType.TO
,
Message.RecipientType.CC
,
Message.RecipientType.BCC
,
MimeMessage.RecipientType.NEWSGROUPS
public void setRecipients(javax.mail.Message.RecipientType type, javax.mail.Address[] addresses) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
null
, the corresponding
recipient field is removed.
setRecipients
in class javax.mail.internet.MimeMessage
type
- Recipient typeaddresses
- Addresses
javax.mail.MessagingException
MimeMessage.getRecipients(javax.mail.Message.RecipientType)
public void addRecipients(javax.mail.Message.RecipientType type, javax.mail.Address[] addresses) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
addRecipients
in class javax.mail.internet.MimeMessage
type
- Recipient typeaddresses
- Addresses
javax.mail.MessagingException
public javax.mail.Address[] getReplyTo() throws javax.mail.MessagingException
getReplyTo
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.headers
public void setReplyTo(javax.mail.Address[] addresses) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
null
, this header is removed.
setReplyTo
in class javax.mail.internet.MimeMessage
addresses
- addresses to which replies should be directed
javax.mail.MessagingException
public java.lang.String getSubject() throws javax.mail.MessagingException
getSubject
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.headers
public void setSubject(java.lang.String subject, java.lang.String charset) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
The application must ensure that the subject does not contain any line breaks.
Note that if the charset encoding process fails, a MessagingException is thrown, and an UnsupportedEncodingException is included in the chain of nested exceptions within the MessagingException.
setSubject
in class javax.mail.internet.MimeMessage
subject
- The subjectcharset
- The charset
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
of existing values
javax.mail.MessagingException
public java.util.Date getSentDate() throws javax.mail.MessagingException
getSentDate
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void setSentDate(java.util.Date d) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
null
, the existing "Date" field is removed.
setSentDate
in class javax.mail.internet.MimeMessage
d
- the sent date of this message
javax.mail.MessagingException
public java.util.Date getReceivedDate() throws javax.mail.MessagingException
getReceivedDate
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public int getSize() throws javax.mail.MessagingException
Note that this returns RFC822.SIZE. That is, it's the size of the whole message, header and body included.
getSize
in interface javax.mail.Part
getSize
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public int getLineCount() throws javax.mail.MessagingException
Returns the "body_fld_lines" field from the BODYSTRUCTURE. Note that this field is available only for text/plain and message/rfc822 types
getLineCount
in interface javax.mail.Part
getLineCount
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.lang.String[] getContentLanguage() throws javax.mail.MessagingException
getContentLanguage
in interface javax.mail.internet.MimePart
getContentLanguage
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void setContentLanguage(java.lang.String[] languages) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
setContentLanguage
in interface javax.mail.internet.MimePart
setContentLanguage
in class javax.mail.internet.MimeMessage
languages
- array of language tags
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
javax.mail.MessagingException
public java.lang.String getInReplyTo() throws javax.mail.MessagingException
javax.mail.MessagingException
public java.lang.String getContentType() throws javax.mail.MessagingException
getContentType
in interface javax.mail.Part
getContentType
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
DataHandler
public java.lang.String getDisposition() throws javax.mail.MessagingException
getDisposition
in interface javax.mail.Part
getDisposition
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
Part.ATTACHMENT
,
Part.INLINE
,
Part.getFileName()
public void setDisposition(java.lang.String disposition) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
disposition
is null, any existing "Content-Disposition"
header field is removed.
setDisposition
in interface javax.mail.Part
setDisposition
in class javax.mail.internet.MimeMessage
disposition
- disposition of this part
javax.mail.MessagingException
Part.ATTACHMENT
,
Part.INLINE
,
Part.setFileName(java.lang.String)
public java.lang.String getEncoding() throws javax.mail.MessagingException
getEncoding
in interface javax.mail.internet.MimePart
getEncoding
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.lang.String getContentID() throws javax.mail.MessagingException
getContentID
in interface javax.mail.internet.MimePart
getContentID
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void setContentID(java.lang.String cid) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
cid
parameter is null, any existing
"Content-ID" is removed.
setContentID
in class javax.mail.internet.MimeMessage
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
javax.mail.MessagingException
public java.lang.String getContentMD5() throws javax.mail.MessagingException
getContentMD5
in interface javax.mail.internet.MimePart
getContentMD5
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void setContentMD5(java.lang.String md5) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
setContentMD5
in interface javax.mail.internet.MimePart
setContentMD5
in class javax.mail.internet.MimeMessage
md5
- the MD5 value
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
javax.mail.MessagingException
public java.lang.String getDescription() throws javax.mail.MessagingException
getDescription
in interface javax.mail.Part
getDescription
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void setDescription(java.lang.String description, java.lang.String charset) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
null
, then any
existing "Content-Description" fields are removed. If the description contains non US-ASCII characters, it will be encoded using the specified charset. If the description contains only US-ASCII characters, no encoding is done and it is used as-is.
Note that if the charset encoding process fails, a MessagingException is thrown, and an UnsupportedEncodingException is included in the chain of nested exceptions within the MessagingException.
setDescription
in class javax.mail.internet.MimeMessage
description
- Descriptioncharset
- Charset for encoding
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
javax.mail.MessagingException
public java.lang.String getMessageID() throws javax.mail.MessagingException
getMessageID
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
- if the retrieval of this field
causes any exception.MessageIDTerm
public java.lang.String getFileName() throws javax.mail.MessagingException
getFileName
in interface javax.mail.Part
getFileName
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void setFileName(java.lang.String filename) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
Sets the "filename" parameter of the "Content-Disposition" header field of this message.
If the mail.mime.encodefilename
System property
is set to true, the MimeUtility.encodeText
method will be used to encode the
filename. While such encoding is not supported by the MIME
spec, many mailers use this technique to support non-ASCII
characters in filenames. The default value of this property
is false.
setFileName
in interface javax.mail.Part
setFileName
in class javax.mail.internet.MimeMessage
filename
- Filename to associate with this part
javax.mail.MessagingException
protected java.io.InputStream getContentStream() throws javax.mail.MessagingException
getContentStream
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeMessage.getContentStream()
public javax.activation.DataHandler getDataHandler() throws javax.mail.MessagingException
getDataHandler
in interface javax.mail.Part
getDataHandler
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void setDataHandler(javax.activation.DataHandler content) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
setDataHandler
in interface javax.mail.Part
setDataHandler
in class javax.mail.internet.MimeMessage
content
- The DataHandler for the content.
javax.mail.MessagingException
public void writeTo(java.io.OutputStream os) throws java.io.IOException, javax.mail.MessagingException
writeTo
in interface javax.mail.Part
writeTo
in class javax.mail.internet.MimeMessage
java.io.IOException
- if an error occurs writing to the stream
or if an error is generated by the
javax.activation layer.
javax.mail.MessagingException
- if an error occurs fetching the
data to be writtenDataHandler.writeTo(java.io.OutputStream)
public java.lang.String[] getHeader(java.lang.String name) throws javax.mail.MessagingException
getHeader
in interface javax.mail.Part
getHeader
in class javax.mail.internet.MimeMessage
name
- name of header
javax.mail.MessagingException
MimeUtility
public java.lang.String getHeader(java.lang.String name, java.lang.String delimiter) throws javax.mail.MessagingException
getHeader
in interface javax.mail.internet.MimePart
getHeader
in class javax.mail.internet.MimeMessage
name
- the name of this headerdelimiter
- separator between values
javax.mail.MessagingException
public void setHeader(java.lang.String name, java.lang.String value) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
setHeader
in interface javax.mail.Part
setHeader
in class javax.mail.internet.MimeMessage
name
- header namevalue
- header value
javax.mail.MessagingException
MimeUtility
public void addHeader(java.lang.String name, java.lang.String value) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
addHeader
in interface javax.mail.Part
addHeader
in class javax.mail.internet.MimeMessage
name
- header namevalue
- header value
javax.mail.MessagingException
MimeUtility
public void removeHeader(java.lang.String name) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
removeHeader
in interface javax.mail.Part
removeHeader
in class javax.mail.internet.MimeMessage
name
- the name of this header
javax.mail.MessagingException
public java.util.Enumeration getAllHeaders() throws javax.mail.MessagingException
getAllHeaders
in interface javax.mail.Part
getAllHeaders
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
MimeUtility
public java.util.Enumeration getMatchingHeaders(java.lang.String[] names) throws javax.mail.MessagingException
getMatchingHeaders
in interface javax.mail.Part
getMatchingHeaders
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.util.Enumeration getNonMatchingHeaders(java.lang.String[] names) throws javax.mail.MessagingException
getNonMatchingHeaders
in interface javax.mail.Part
getNonMatchingHeaders
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public void addHeaderLine(java.lang.String line) throws javax.mail.MessagingException
javax.mail.internet.MimeMessage
addHeaderLine
in interface javax.mail.internet.MimePart
addHeaderLine
in class javax.mail.internet.MimeMessage
javax.mail.IllegalWriteException
- if the underlying
implementation does not support modification
javax.mail.MessagingException
public java.util.Enumeration getAllHeaderLines() throws javax.mail.MessagingException
getAllHeaderLines
in interface javax.mail.internet.MimePart
getAllHeaderLines
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.util.Enumeration getMatchingHeaderLines(java.lang.String[] names) throws javax.mail.MessagingException
getMatchingHeaderLines
in interface javax.mail.internet.MimePart
getMatchingHeaderLines
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public java.util.Enumeration getNonMatchingHeaderLines(java.lang.String[] names) throws javax.mail.MessagingException
getNonMatchingHeaderLines
in interface javax.mail.internet.MimePart
getNonMatchingHeaderLines
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
public javax.mail.Flags getFlags() throws javax.mail.MessagingException
getFlags
in class javax.mail.internet.MimeMessage
javax.mail.MessagingException
Flags
public boolean isSet(javax.mail.Flags.Flag flag) throws javax.mail.MessagingException
isSet
in class javax.mail.internet.MimeMessage
flag
- the flag
javax.mail.MessagingException
Flags.Flag
,
Flags.Flag.ANSWERED
,
Flags.Flag.DELETED
,
Flags.Flag.DRAFT
,
Flags.Flag.FLAGGED
,
Flags.Flag.RECENT
,
Flags.Flag.SEEN
public void setFlags(javax.mail.Flags flag, boolean set) throws javax.mail.MessagingException
setFlags
in class javax.mail.internet.MimeMessage
flag
- Flags object containing the flags to be setset
- the value to be set
javax.mail.MessagingException
MessageChangedEvent
public void setPeek(boolean peek)
public boolean getPeek()
public void invalidateHeaders()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |