This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


com.sun.mail.imap
class IMAPMessage

javax.mail.Message extended by javax.mail.internet.MimeMessage extended by com.sun.mail.imap.IMAPMessage
All Implemented Interfaces:
Part, MimePart
Direct Known Subclasses:
IMAPNestedMessage

public class IMAPMessage
extends MimeMessage

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
MimeMessage.RecipientType
 
Nested classes/interfaces inherited from class javax.mail.Message
Message.RecipientType
   
Field Summary
protected BODYSTRUCTURE bs
          
protected ENVELOPE envelope
          
protected 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
 
Constructor Summary
protected
IMAPMessage(IMAPFolder folder, int msgnum, int seqnum)

          Constructor.
protected

          Constructor, for use by IMAPNestedMessage.
 
Method Summary
 void
addFrom(Address[] addresses)

          Add the specified addresses to the existing "From" field.
 void
addHeader(String name, String value)

          Add this value to the existing values for this header_name.
 void

          Add a raw RFC 822 header-line.
 void

          Add the given addresses to the specified recipient type.
protected void

          
protected void

          Do a NOOP to force any untagged EXPUNGE responses and then check if this message is expunged.
 Enumeration

          Get all header-lines.
 Enumeration

          Get all headers.
 String

          Get the Content-ID.
 String[]

          Get the content language.
 String

          Get the Content-MD5.
protected InputStream

          Get all the bytes for this message.
 String

          Get the Content-Type.
 DataHandler

          Get the DataHandler object for this message.
 String

          Get the decoded Content-Description.
 String

          Get the Content-Disposition.
 String

          Get the Content-Transfer-Encoding.
protected int

          
 String

          Get the "filename" Disposition parameter.
 Flags

          Get the Flags for this message.
 Address[]

          Get the "From" attribute.
 String[]

          Get the named header.
 String
getHeader(String name, String delimiter)

          Get the named header.
 String

          Get the In-Reply-To header.
 int

          Get the total number of lines.
 Enumeration

          Get all matching header-lines.
 Enumeration

          Get matching headers.
protected Object

          Get the messageCacheLock, associated with this Message's Folder.
 String

          Get the Message-ID.
 Enumeration

          Get all non-matching headerlines.
 Enumeration

          Get non-matching headers.
 boolean

          Get whether or not to use the PEEK variant of FETCH when fetching message content.
protected IMAPProtocol

          Get this message's folder's protocol connection.
 Date

          Get the recieved date (INTERNALDATE)
 Address[]

          Get the desired Recipient type.
 Address[]

          Get the ReplyTo addresses.
 Address

          Get the "Sender" attribute.
 Date

          Get the SentDate.
protected int

          Get this message's IMAP sequence number.
 int

          Get the message size.
 String

          Get the decoded subject.
protected long

          
 void

          Invalidate cached header and envelope information for this message.
protected boolean

          
 boolean

          Test if the given Flags are set in this message.
 void

          Remove all headers with this name.
 void

          Set the "Content-ID" header field of this Message.
 void

          Set the "Content-Language" header of this MimePart.
 void

          Set the "Content-MD5" header field of this Message.
 void

          This method provides the mechanism to set this part's content.
 void
setDescription(String description, String charset)

          Set the "Content-Description" header field for this Message.
 void
setDisposition(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(String filename)

          Set the filename associated with this part, if possible.
 void
setFlags(Flags flag, boolean set)

          Set/Unset the given flags in this message.
 void
setFrom(Address address)

          Set the RFC 822 "From" header field.
 void
setHeader(String name, 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

          Set the specified recipient type to the given addresses.
 void
setReplyTo(Address[] addresses)

          Set the RFC 822 "Reply-To" header field.
 void
setSender(Address address)

          Set the RFC 822 "Sender" header field.
 void

          Set the RFC 822 "Date" header field.
protected void
setSequenceNumber(int seqnum)

          Set this message's IMAP sequence number.
 void
setSubject(String subject, String charset)

          Set the "Subject" header field.
protected void
setUID(long uid)

          
 void

          Write out the bytes into the given outputstream.
 
Methods inherited from class javax.mail.internet.MimeMessage
addFrom, addHeader, addHeaderLine, addRecipients, addRecipients, createInternetHeaders, createMimeMessage, getAllHeaderLines, getAllHeaders, getAllRecipients, getContent, getContentID, getContentLanguage, getContentMD5, getContentStream, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFileName, getFlags, getFrom, getHeader, getHeader, getInputStream, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getMessageID, getNonMatchingHeaderLines, getNonMatchingHeaders, getRawInputStream, getReceivedDate, getRecipients, getReplyTo, getSender, getSentDate, getSize, getSubject, isMimeType, isSet, parse, removeHeader, reply, saveChanges, setContent, setContent, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setFlags, setFrom, setFrom, setHeader, setRecipients, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setSubject, setText, setText, setText, updateHeaders, updateMessageID, writeTo, writeTo
 
Methods inherited from class javax.mail.Message
addFrom, addRecipient, addRecipients, getAllRecipients, getFlags, getFolder, getFrom, getMessageNumber, getReceivedDate, getRecipients, getReplyTo, getSentDate, getSubject, isExpunged, isSet, match, reply, saveChanges, send, setExpunged, setFlag, setFlags, setFrom, setFrom, setMessageNumber, setRecipient, setRecipients, setReplyTo, setSentDate, setSubject
 

Field Detail

bs

protected BODYSTRUCTURE bs

envelope

protected ENVELOPE envelope

sectionId

protected String sectionId
Constructor Detail

IMAPMessage

protected IMAPMessage(IMAPFolder folder,
                      int msgnum,
                      int seqnum)
Constructor.

Parameters:
folder
msgnum
seqnum

IMAPMessage

protected IMAPMessage(Session session)
Constructor, for use by IMAPNestedMessage.

Parameters:
session
Method Detail

addFrom

public void addFrom(Address[] addresses)
             throws MessagingException
Overrides:
addFrom in class MimeMessage
Parameters:
addresses
Throws:
MessagingException

addHeader

public void addHeader(String name,
                      String value)
               throws MessagingException
Overrides:
addHeader in class MimeMessage
Parameters:
name
value
Throws:
MessagingException

addHeaderLine

public void addHeaderLine(String line)
                   throws MessagingException
Overrides:
addHeaderLine in class MimeMessage
Parameters:
line
Throws:
MessagingException

addRecipients

public void addRecipients(Message.RecipientType type,
                          Address[] addresses)
                   throws MessagingException
Overrides:
addRecipients in class MimeMessage
Parameters:
type
addresses
Throws:
MessagingException

checkExpunged

protected void checkExpunged()
                      throws MessageRemovedException
Throws:
MessageRemovedException

forceCheckExpunged

protected void forceCheckExpunged()
                           throws MessageRemovedException,
                                  FolderClosedException
Do a NOOP to force any untagged EXPUNGE responses and then check if this message is expunged.

Throws:
MessageRemovedException
FolderClosedException

getAllHeaderLines

public Enumeration getAllHeaderLines()
                              throws MessagingException
Get all header-lines.

Overrides:
getAllHeaderLines in class MimeMessage
Throws:
MessagingException

getAllHeaders

public Enumeration getAllHeaders()
                          throws MessagingException
Get all headers.

Overrides:
getAllHeaders in class MimeMessage
Throws:
MessagingException

getContentID

public String getContentID()
                    throws MessagingException
Get the Content-ID.

Overrides:
getContentID in class MimeMessage
Throws:
MessagingException

getContentLanguage

public String[] getContentLanguage()
                            throws MessagingException
Get the content language.

Overrides:
getContentLanguage in class MimeMessage
Throws:
MessagingException

getContentMD5

public String getContentMD5()
                     throws MessagingException
Get the Content-MD5.

Overrides:
getContentMD5 in class MimeMessage
Throws:
MessagingException

getContentStream

protected InputStream getContentStream()
                                throws MessagingException
Get all the bytes for this message. Overrides getContentStream() in MimeMessage. This method is ultimately used by the DataHandler to obtain the input stream for this message.

Overrides:
getContentStream in class MimeMessage
Throws:
MessagingException

getContentType

public String getContentType()
                      throws MessagingException
Get the Content-Type. Generate this header from the BODYSTRUCTURE. Append parameters as well.

Overrides:
getContentType in class MimeMessage
Throws:
MessagingException

getDataHandler

public synchronized DataHandler getDataHandler()
                                        throws MessagingException
Get the DataHandler object for this message.

Overrides:
getDataHandler in class MimeMessage
Throws:
MessagingException

getDescription

public String getDescription()
                      throws MessagingException
Get the decoded Content-Description.

Overrides:
getDescription in class MimeMessage
Throws:
MessagingException

getDisposition

public String getDisposition()
                      throws MessagingException
Get the Content-Disposition.

Overrides:
getDisposition in class MimeMessage
Throws:
MessagingException

getEncoding

public String getEncoding()
                   throws MessagingException
Get the Content-Transfer-Encoding.

Overrides:
getEncoding in class MimeMessage
Throws:
MessagingException

getFetchBlockSize

protected int getFetchBlockSize()

getFileName

public String getFileName()
                   throws MessagingException
Get the "filename" Disposition parameter. (Only available in IMAP4rev1). If thats not available, get the "name" ContentType parameter.

Overrides:
getFileName in class MimeMessage
Throws:
MessagingException

getFlags

public synchronized Flags getFlags()
                            throws MessagingException
Get the Flags for this message.

Overrides:
getFlags in class MimeMessage
Throws:
MessagingException

getFrom

public Address[] getFrom()
                  throws MessagingException
Get the "From" attribute.

Overrides:
getFrom in class MimeMessage
Throws:
MessagingException

getHeader

public String[] getHeader(String name)
                   throws MessagingException
Get the named header.

Overrides:
getHeader in class MimeMessage
Parameters:
name
Throws:
MessagingException

getHeader

public String getHeader(String name,
                        String delimiter)
                 throws MessagingException
Get the named header.

Overrides:
getHeader in class MimeMessage
Parameters:
name
delimiter
Throws:
MessagingException

getInReplyTo

public String getInReplyTo()
                    throws MessagingException
Get the In-Reply-To header.

Throws:
MessagingException

getLineCount

public int getLineCount()
                 throws MessagingException
Get the total number of lines.

Returns the "body_fld_lines" field from the BODYSTRUCTURE. Note that this field is available only for text/plain and message/rfc822 types

Overrides:
getLineCount in class MimeMessage
Throws:
MessagingException

getMatchingHeaderLines

public Enumeration getMatchingHeaderLines(String[] names)
                                   throws MessagingException
Get all matching header-lines.

Overrides:
getMatchingHeaderLines in class MimeMessage
Parameters:
names
Throws:
MessagingException

getMatchingHeaders

public Enumeration getMatchingHeaders(String[] names)
                               throws MessagingException
Get matching headers.

Overrides:
getMatchingHeaders in class MimeMessage
Parameters:
names
Throws:
MessagingException

getMessageCacheLock

protected Object getMessageCacheLock()
Get the messageCacheLock, associated with this Message's Folder.


getMessageID

public String getMessageID()
                    throws MessagingException
Get the Message-ID.

Overrides:
getMessageID in class MimeMessage
Throws:
MessagingException

getNonMatchingHeaderLines

public Enumeration getNonMatchingHeaderLines(String[] names)
                                      throws MessagingException
Get all non-matching headerlines.

Overrides:
getNonMatchingHeaderLines in class MimeMessage
Parameters:
names
Throws:
MessagingException

getNonMatchingHeaders

public Enumeration getNonMatchingHeaders(String[] names)
                                  throws MessagingException
Get non-matching headers.

Overrides:
getNonMatchingHeaders in class MimeMessage
Parameters:
names
Throws:
MessagingException

getPeek

public synchronized boolean getPeek()
Get whether or not to use the PEEK variant of FETCH when fetching message content.


getProtocol

protected IMAPProtocol getProtocol()
                            throws ProtocolException,
                                   FolderClosedException
Get this message's folder's protocol connection. Throws FolderClosedException, if the protocol connection is not available. ASSERT: Must hold the messageCacheLock.

Throws:
ProtocolException
FolderClosedException

getReceivedDate

public Date getReceivedDate()
                     throws MessagingException
Get the recieved date (INTERNALDATE)

Overrides:
getReceivedDate in class MimeMessage
Throws:
MessagingException

getRecipients

public Address[] getRecipients(Message.RecipientType type)
                        throws MessagingException
Get the desired Recipient type.

Overrides:
getRecipients in class MimeMessage
Parameters:
type
Throws:
MessagingException

getReplyTo

public Address[] getReplyTo()
                     throws MessagingException
Get the ReplyTo addresses.

Overrides:
getReplyTo in class MimeMessage
Throws:
MessagingException

getSender

public Address getSender()
                  throws MessagingException
Get the "Sender" attribute.

Overrides:
getSender in class MimeMessage
Throws:
MessagingException

getSentDate

public Date getSentDate()
                 throws MessagingException
Get the SentDate.

Overrides:
getSentDate in class MimeMessage
Throws:
MessagingException

getSequenceNumber

protected int getSequenceNumber()
Get this message's IMAP sequence number. ASSERT: This method must be called only when holding the messageCacheLock.


getSize

public int getSize()
            throws MessagingException
Get the message size.

Note that this returns RFC822.SIZE. That is, it's the size of the whole message, header and body included.

Overrides:
getSize in class MimeMessage
Throws:
MessagingException

getSubject

public String getSubject()
                  throws MessagingException
Get the decoded subject.

Overrides:
getSubject in class MimeMessage
Throws:
MessagingException

getUID

protected long getUID()

invalidateHeaders

public synchronized void invalidateHeaders()
Invalidate cached header and envelope information for this message. Subsequent accesses of this information will cause it to be fetched from the server.


isREV1

protected boolean isREV1()
                  throws FolderClosedException
Throws:
FolderClosedException

isSet

public synchronized boolean isSet(Flags.Flag flag)
                           throws MessagingException
Test if the given Flags are set in this message.

Overrides:
isSet in class MimeMessage
Parameters:
flag
Throws:
MessagingException

removeHeader

public void removeHeader(String name)
                  throws MessagingException
Overrides:
removeHeader in class MimeMessage
Parameters:
name
Throws:
MessagingException

setContentID

public void setContentID(String cid)
                  throws MessagingException
Overrides:
setContentID in class MimeMessage
Parameters:
cid
Throws:
MessagingException

setContentLanguage

public void setContentLanguage(String[] languages)
                        throws MessagingException
Overrides:
setContentLanguage in class MimeMessage
Parameters:
languages
Throws:
MessagingException

setContentMD5

public void setContentMD5(String md5)
                   throws MessagingException
Overrides:
setContentMD5 in class MimeMessage
Parameters:
md5
Throws:
MessagingException

setDataHandler

public void setDataHandler(DataHandler content)
                    throws MessagingException
Overrides:
setDataHandler in class MimeMessage
Parameters:
content
Throws:
MessagingException

setDescription

public void setDescription(String description,
                           String charset)
                    throws MessagingException
Overrides:
setDescription in class MimeMessage
Parameters:
description
charset
Throws:
MessagingException

setDisposition

public void setDisposition(String disposition)
                    throws MessagingException
Overrides:
setDisposition in class MimeMessage
Parameters:
disposition
Throws:
MessagingException

setExpunged

protected void setExpunged(boolean set)
Overrides:
setExpunged in class Message
Parameters:
set

setFileName

public void setFileName(String filename)
                 throws MessagingException
Overrides:
setFileName in class MimeMessage
Parameters:
filename
Throws:
MessagingException

setFlags

public synchronized void setFlags(Flags flag,
                                  boolean set)
                           throws MessagingException
Set/Unset the given flags in this message.

Overrides:
setFlags in class MimeMessage
Parameters:
flag
set
Throws:
MessagingException

setFrom

public void setFrom(Address address)
             throws MessagingException
Overrides:
setFrom in class MimeMessage
Parameters:
address
Throws:
MessagingException

setHeader

public void setHeader(String name,
                      String value)
               throws MessagingException
Overrides:
setHeader in class MimeMessage
Parameters:
name
value
Throws:
MessagingException

setMessageNumber

protected void setMessageNumber(int msgnum)
Wrapper around the protected method Message.setMessageNumber() to make that method accessible to IMAPFolder.

Overrides:
setMessageNumber in class Message
Parameters:
msgnum

setPeek

public synchronized void setPeek(boolean peek)
Set whether or not to use the PEEK variant of FETCH when fetching message content.

Parameters:
peek

setRecipients

public void setRecipients(Message.RecipientType type,
                          Address[] addresses)
                   throws MessagingException
Overrides:
setRecipients in class MimeMessage
Parameters:
type
addresses
Throws:
MessagingException

setReplyTo

public void setReplyTo(Address[] addresses)
                throws MessagingException
Overrides:
setReplyTo in class MimeMessage
Parameters:
addresses
Throws:
MessagingException

setSender

public void setSender(Address address)
               throws MessagingException
Overrides:
setSender in class MimeMessage
Parameters:
address
Throws:
MessagingException

setSentDate

public void setSentDate(Date d)
                 throws MessagingException
Overrides:
setSentDate in class MimeMessage
Parameters:
d
Throws:
MessagingException

setSequenceNumber

protected void setSequenceNumber(int seqnum)
Set this message's IMAP sequence number. ASSERT: This method must be called only when holding the messageCacheLock.

Parameters:
seqnum

setSubject

public void setSubject(String subject,
                       String charset)
                throws MessagingException
Overrides:
setSubject in class MimeMessage
Parameters:
subject
charset
Throws:
MessagingException

setUID

protected void setUID(long uid)
Parameters:
uid

writeTo

public void writeTo(OutputStream os)
             throws IOException,
                    MessagingException
Write out the bytes into the given outputstream.

Overrides:
writeTo in class MimeMessage
Parameters:
os
Throws:
IOException
MessagingException


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention. The official Sun™ documentation can be found here at http://java.sun.com/products/javamail/javadocs/index.html.