public class IMAPMessage
extends MimeMessage
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.
| Modifier and Type | Class and Description |
|---|---|
static class |
IMAPMessage.FetchProfileCondition
This class implements the test to be done on each
message in the folder.
|
| Modifier and Type | Field and Description |
|---|---|
protected BODYSTRUCTURE |
bs |
protected ENVELOPE |
envelope |
protected Map |
items
A map of the extension FETCH items.
|
protected String |
sectionId |
| Modifier | Constructor and Description |
|---|---|
protected |
IMAPMessage(IMAPFolder folder,
int msgnum)
Constructor.
|
protected |
IMAPMessage(Session session)
Constructor, for use by IMAPNestedMessage.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addFrom(Address[] addresses) |
void |
addHeader(String name,
String value) |
void |
addHeaderLine(String line) |
void |
addRecipients(Message.RecipientType type,
Address[] addresses) |
protected void |
checkExpunged() |
protected Object |
fetchItem(FetchItem fitem)
Fetch an individual item for the current message.
|
protected void |
forceCheckExpunged()
Do a NOOP to force any untagged EXPUNGE responses
and then check if this message is expunged.
|
Enumeration |
getAllHeaderLines()
Get all header-lines.
|
Enumeration |
getAllHeaders()
Get all headers.
|
String |
getContentID()
Get the Content-ID.
|
String[] |
getContentLanguage()
Get the content language.
|
String |
getContentMD5()
Get the Content-MD5.
|
protected InputStream |
getContentStream()
Get all the bytes for this message.
|
String |
getContentType()
Get the Content-Type.
|
DataHandler |
getDataHandler()
Get the DataHandler object for this message.
|
String |
getDescription()
Get the decoded Content-Description.
|
String |
getDisposition()
Get the Content-Disposition.
|
String |
getEncoding()
Get the Content-Transfer-Encoding.
|
protected int |
getFetchBlockSize() |
String |
getFileName()
Get the "filename" Disposition parameter.
|
Flags |
getFlags()
Get the Flags for this message.
|
Address[] |
getFrom()
Get the "From" attribute.
|
String[] |
getHeader(String name)
Get the named header.
|
String |
getHeader(String name,
String delimiter)
Get the named header.
|
String |
getInReplyTo()
Get the In-Reply-To header.
|
Object |
getItem(FetchItem fitem)
Return the data associated with the FetchItem.
|
int |
getLineCount()
Get the total number of lines.
|
Enumeration |
getMatchingHeaderLines(String[] names)
Get all matching header-lines.
|
Enumeration |
getMatchingHeaders(String[] names)
Get matching headers.
|
protected Object |
getMessageCacheLock()
Get the messageCacheLock, associated with this Message's
Folder.
|
String |
getMessageID()
Get the Message-ID.
|
InputStream |
getMimeStream()
Return the MIME format stream corresponding to this message.
|
Enumeration |
getNonMatchingHeaderLines(String[] names)
Get all non-matching headerlines.
|
Enumeration |
getNonMatchingHeaders(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.
|
Date |
getReceivedDate()
Get the recieved date (INTERNALDATE)
|
Address[] |
getRecipients(Message.RecipientType type)
Get the desired Recipient type.
|
Address[] |
getReplyTo()
Get the ReplyTo addresses.
|
Address |
getSender()
Get the "Sender" attribute.
|
Date |
getSentDate()
Get the SentDate.
|
protected int |
getSequenceNumber()
Get this message's IMAP sequence number.
|
int |
getSize()
Get the message size.
|
String |
getSubject()
Get the decoded subject.
|
protected long |
getUID() |
protected void |
handleExtensionFetchItems(Map extensionItems)
Apply the data in the extension FETCH items to this message.
|
protected boolean |
handleFetchItem(Item item,
String[] hdrs,
boolean allHeaders)
Apply the data in the FETCH item to this message.
|
protected boolean |
ignoreBodyStructureSize() |
void |
invalidateHeaders()
Invalidate cached header and envelope information for this
message.
|
protected boolean |
isREV1() |
boolean |
isSet(Flags.Flag flag)
Test if the given Flags are set in this message.
|
void |
removeHeader(String name) |
void |
setContentID(String cid) |
void |
setContentLanguage(String[] languages) |
void |
setContentMD5(String md5) |
void |
setDataHandler(DataHandler content) |
void |
setDescription(String description,
String charset) |
void |
setDisposition(String disposition) |
protected void |
setExpunged(boolean set) |
void |
setFileName(String filename) |
void |
setFlags(Flags flag,
boolean set)
Set/Unset the given flags in this message.
|
void |
setFrom(Address address) |
void |
setHeader(String name,
String value) |
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(Message.RecipientType type,
Address[] addresses) |
void |
setReplyTo(Address[] addresses) |
void |
setSender(Address address) |
void |
setSentDate(Date d) |
void |
setSubject(String subject,
String charset) |
protected void |
setUID(long uid) |
void |
writeTo(OutputStream os)
Write out the bytes into the given OutputStream.
|
protected BODYSTRUCTURE bs
protected ENVELOPE envelope
protected Map items
protected String sectionId
protected IMAPMessage(IMAPFolder folder, int msgnum)
protected IMAPMessage(Session session)
protected IMAPProtocol getProtocol() throws ProtocolException, FolderClosedException
ProtocolExceptionFolderClosedExceptionprotected boolean isREV1()
throws FolderClosedException
FolderClosedExceptionprotected Object getMessageCacheLock()
protected int getSequenceNumber()
protected void setMessageNumber(int msgnum)
protected long getUID()
protected void setUID(long uid)
protected void setExpunged(boolean set)
protected void checkExpunged()
throws MessageRemovedException
MessageRemovedExceptionprotected void forceCheckExpunged()
throws MessageRemovedException,
FolderClosedException
MessageRemovedExceptionFolderClosedExceptionprotected int getFetchBlockSize()
protected boolean ignoreBodyStructureSize()
public Address[] getFrom()
throws MessagingException
MessagingExceptionpublic void setFrom(Address address)
throws MessagingException
MessagingExceptionpublic void addFrom(Address[] addresses)
throws MessagingException
MessagingExceptionpublic Address getSender()
throws MessagingException
MessagingExceptionpublic void setSender(Address address)
throws MessagingException
MessagingExceptionpublic Address[] getRecipients(Message.RecipientType type)
throws MessagingException
MessagingExceptionpublic void setRecipients(Message.RecipientType type,
Address[] addresses)
throws MessagingException
MessagingExceptionpublic void addRecipients(Message.RecipientType type,
Address[] addresses)
throws MessagingException
MessagingExceptionpublic Address[] getReplyTo()
throws MessagingException
MessagingExceptionpublic void setReplyTo(Address[] addresses)
throws MessagingException
MessagingExceptionpublic String getSubject() throws MessagingException
MessagingExceptionpublic void setSubject(String subject, String charset) throws MessagingException
MessagingExceptionpublic Date getSentDate() throws MessagingException
MessagingExceptionpublic void setSentDate(Date d) throws MessagingException
MessagingExceptionpublic Date getReceivedDate() throws MessagingException
MessagingExceptionpublic int getSize()
throws MessagingException
Note that this returns RFC822.SIZE. That is, it's the size of the whole message, header and body included.
MessagingExceptionpublic int getLineCount()
throws MessagingException
Returns the "body_fld_lines" field from the BODYSTRUCTURE. Note that this field is available only for text/plain and message/rfc822 types
MessagingExceptionpublic String[] getContentLanguage() throws MessagingException
MessagingExceptionpublic void setContentLanguage(String[] languages) throws MessagingException
MessagingExceptionpublic String getInReplyTo() throws MessagingException
MessagingExceptionpublic String getContentType() throws MessagingException
MessagingExceptionpublic String getDisposition() throws MessagingException
MessagingExceptionpublic void setDisposition(String disposition) throws MessagingException
MessagingExceptionpublic String getEncoding() throws MessagingException
MessagingExceptionpublic String getContentID() throws MessagingException
MessagingExceptionpublic void setContentID(String cid) throws MessagingException
MessagingExceptionpublic String getContentMD5() throws MessagingException
MessagingExceptionpublic void setContentMD5(String md5) throws MessagingException
MessagingExceptionpublic String getDescription() throws MessagingException
MessagingExceptionpublic void setDescription(String description, String charset) throws MessagingException
MessagingExceptionpublic String getMessageID() throws MessagingException
MessagingExceptionpublic String getFileName() throws MessagingException
MessagingExceptionpublic void setFileName(String filename) throws MessagingException
MessagingExceptionprotected InputStream getContentStream() throws MessagingException
MessagingExceptionMimeMessagepublic DataHandler getDataHandler() throws MessagingException
MessagingExceptionpublic void setDataHandler(DataHandler content) throws MessagingException
MessagingExceptionpublic InputStream getMimeStream() throws MessagingException
MessagingExceptionpublic void writeTo(OutputStream os) throws IOException, MessagingException
IOExceptionMessagingExceptionpublic String[] getHeader(String name) throws MessagingException
MessagingExceptionpublic String getHeader(String name, String delimiter) throws MessagingException
MessagingExceptionpublic void setHeader(String name, String value) throws MessagingException
MessagingExceptionpublic void addHeader(String name, String value) throws MessagingException
MessagingExceptionpublic void removeHeader(String name) throws MessagingException
MessagingExceptionpublic Enumeration getAllHeaders() throws MessagingException
MessagingExceptionpublic Enumeration getMatchingHeaders(String[] names) throws MessagingException
MessagingExceptionpublic Enumeration getNonMatchingHeaders(String[] names) throws MessagingException
MessagingExceptionpublic void addHeaderLine(String line) throws MessagingException
MessagingExceptionpublic Enumeration getAllHeaderLines() throws MessagingException
MessagingExceptionpublic Enumeration getMatchingHeaderLines(String[] names) throws MessagingException
MessagingExceptionpublic Enumeration getNonMatchingHeaderLines(String[] names) throws MessagingException
MessagingExceptionpublic Flags getFlags()
throws MessagingException
MessagingExceptionpublic boolean isSet(Flags.Flag flag)
throws MessagingException
MessagingExceptionpublic void setFlags(Flags flag,
boolean set)
throws MessagingException
MessagingExceptionpublic void setPeek(boolean peek)
public boolean getPeek()
public void invalidateHeaders()
protected boolean handleFetchItem(Item item, String[] hdrs, boolean allHeaders) throws MessagingException
MessagingExceptionprotected void handleExtensionFetchItems(Map extensionItems) throws MessagingException
MessagingExceptionprotected Object fetchItem(FetchItem fitem) throws MessagingException
MessagingExceptionCopyright © 2013 Oracle. All Rights Reserved.