gnu.mail.providers.imap
Class IMAPMessage

java.lang.Object
  extended by javax.mail.Message
      extended by javax.mail.internet.MimeMessage
          extended by gnu.mail.providers.ReadOnlyMessage
              extended by gnu.mail.providers.imap.IMAPMessage
All Implemented Interfaces:
MimePart, Part

public final class IMAPMessage
extends gnu.mail.providers.ReadOnlyMessage

The message class implementing the IMAP4 mail protocol.

Version:
1.0
Author:
Chris Burdess

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.mail.internet.MimeMessage
MimeMessage.RecipientType
 
Field Summary
protected  boolean headersComplete
          If set, the current set of headers is complete.
protected  java.lang.String internalDate
          If set, this contains the string value of the received date.
protected static java.text.DateFormat internalDateFormat
          The date format used to parse IMAP INTERNALDATE values.
protected  long uid
          The UID associated with this message.
 
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
 
Method Summary
 java.util.Enumeration getAllHeaderLines()
          Returns all the header-lines.
 java.util.Enumeration getAllHeaders()
          Returns all the headers.
 java.lang.Object getContent()
          Returns this message's content as a Java object.
protected  java.io.InputStream getContentStream()
          Returns the raw content stream.
 javax.activation.DataHandler getDataHandler()
          Returns a data handler for this message's content.
 Flags getFlags()
          Returns the flags for this message.
 java.lang.String[] getHeader(java.lang.String name)
          Returns the specified header field.
 java.lang.String getHeader(java.lang.String name, java.lang.String delimiter)
          Returns the specified header field.
 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.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.util.Date getReceivedDate()
          Returns the date on which this message was received.
 boolean isSet(Flags.Flag flag)
          Indicates whether the specified flag is set in this message.
 void setFlags(Flags flag, boolean set)
          Set the specified flags.
 void writeTo(java.io.OutputStream msgStream)
          Writes this message to the specified stream in RFC 822 format.
 void writeTo(java.io.OutputStream msgStream, java.lang.String[] ignoreList)
          Writes this message to the specified stream in RFC 822 format, without the specified headers.
 
Methods inherited from class gnu.mail.providers.ReadOnlyMessage
addHeader, addHeaderLine, removeHeader, saveChanges, setContent, setContent, setHeader
 
Methods inherited from class javax.mail.internet.MimeMessage
addFrom, addRecipients, addRecipients, createInternetHeaders, createMimeMessage, getAllRecipients, getContentID, getContentLanguage, getContentMD5, getContentType, getDescription, getDisposition, getEncoding, getFileName, getFrom, getInputStream, getLineCount, getMessageID, getRawInputStream, getRecipients, getReplyTo, getSender, getSentDate, getSize, getSubject, isMimeType, parse, reply, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDescription, setDisposition, setFileName, setFrom, setFrom, setRecipients, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setSubject, setText, setText, setText, updateHeaders, updateMessageId
 
Methods inherited from class javax.mail.Message
addRecipient, getFolder, getMessageNumber, isExpunged, match, setExpunged, setFlag, setMessageNumber, setRecipient
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

internalDate

protected java.lang.String internalDate
If set, this contains the string value of the received date.


uid

protected long uid
The UID associated with this message.


internalDateFormat

protected static final java.text.DateFormat internalDateFormat
The date format used to parse IMAP INTERNALDATE values.


headersComplete

protected boolean headersComplete
If set, the current set of headers is complete. If false, and a header is requested but returns null, all headers will be requested from the server.

Method Detail

getReceivedDate

public java.util.Date getReceivedDate()
                               throws MessagingException
Returns the date on which this message was received.

Overrides:
getReceivedDate in class MimeMessage
Throws:
MessagingException

getDataHandler

public javax.activation.DataHandler getDataHandler()
                                            throws MessagingException
Returns a data handler for this message's content.

Specified by:
getDataHandler in interface Part
Overrides:
getDataHandler in class MimeMessage
Throws:
MessagingException

getContent

public java.lang.Object getContent()
                            throws MessagingException,
                                   java.io.IOException
Description copied from class: MimeMessage
Returns this message's content as a Java object.

Specified by:
getContent in interface Part
Overrides:
getContent in class MimeMessage
Throws:
java.io.IOException - if an error occurred in the data handler layer
MessagingException

getContentStream

protected java.io.InputStream getContentStream()
                                        throws MessagingException
Returns the raw content stream.

Overrides:
getContentStream in class MimeMessage
Throws:
MessagingException
See Also:
MimeBodyPart.getContentStream()

getHeader

public java.lang.String[] getHeader(java.lang.String name)
                             throws MessagingException
Returns the specified header field.

Specified by:
getHeader in interface Part
Overrides:
getHeader in class MimeMessage
Parameters:
name - the header name
Throws:
MessagingException

getHeader

public java.lang.String getHeader(java.lang.String name,
                                  java.lang.String delimiter)
                           throws MessagingException
Returns the specified header field.

Specified by:
getHeader in interface MimePart
Overrides:
getHeader in class MimeMessage
Parameters:
name - the header name
delimiter - the delimiter
Throws:
MessagingException

getAllHeaders

public java.util.Enumeration getAllHeaders()
                                    throws MessagingException
Description copied from class: MimeMessage
Returns all the headers.

Specified by:
getAllHeaders in interface Part
Overrides:
getAllHeaders in class MimeMessage
Returns:
an Enumeration of Header objects
Throws:
MessagingException

getAllHeaderLines

public java.util.Enumeration getAllHeaderLines()
                                        throws MessagingException
Description copied from class: MimeMessage
Returns all the header-lines.

Specified by:
getAllHeaderLines in interface MimePart
Overrides:
getAllHeaderLines in class MimeMessage
Returns:
an Enumeration of Strings
Throws:
MessagingException

getMatchingHeaders

public java.util.Enumeration getMatchingHeaders(java.lang.String[] names)
                                         throws MessagingException
Description copied from class: MimeMessage
Returns all the headers with any of the given names.

Specified by:
getMatchingHeaders in interface Part
Overrides:
getMatchingHeaders in class MimeMessage
Parameters:
names - the header names to match
Returns:
an Enumeration of Header objects
Throws:
MessagingException

getMatchingHeaderLines

public java.util.Enumeration getMatchingHeaderLines(java.lang.String[] names)
                                             throws MessagingException
Description copied from class: MimeMessage
Returns all the header-lines with any of the given names.

Specified by:
getMatchingHeaderLines in interface MimePart
Overrides:
getMatchingHeaderLines in class MimeMessage
Returns:
an Enumeration of Strings
Throws:
MessagingException

getNonMatchingHeaders

public java.util.Enumeration getNonMatchingHeaders(java.lang.String[] names)
                                            throws MessagingException
Description copied from class: MimeMessage
Returns all the headers without any of the given names.

Specified by:
getNonMatchingHeaders in interface Part
Overrides:
getNonMatchingHeaders in class MimeMessage
Parameters:
names - the header names to ignore
Returns:
an Enumeration of Header objects
Throws:
MessagingException

getNonMatchingHeaderLines

public java.util.Enumeration getNonMatchingHeaderLines(java.lang.String[] names)
                                                throws MessagingException
Description copied from class: MimeMessage
Returns all the header-lines without any of the given names.

Specified by:
getNonMatchingHeaderLines in interface MimePart
Overrides:
getNonMatchingHeaderLines in class MimeMessage
Returns:
an Enumeration of Strings
Throws:
MessagingException

getFlags

public Flags getFlags()
               throws MessagingException
Description copied from class: MimeMessage
Returns the flags for this message.

Overrides:
getFlags in class MimeMessage
Throws:
MessagingException

isSet

public boolean isSet(Flags.Flag flag)
              throws MessagingException
Description copied from class: MimeMessage
Indicates whether the specified flag is set in this message.

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

setFlags

public void setFlags(Flags flag,
                     boolean set)
              throws MessagingException
Set the specified flags.

Overrides:
setFlags in class gnu.mail.providers.ReadOnlyMessage
Parameters:
flag - the flags to be set
set - the value to be set
Throws:
IllegalWriteException - if the underlying implementation does not support modification of existing values
MessagingException

writeTo

public void writeTo(java.io.OutputStream msgStream)
             throws java.io.IOException,
                    MessagingException
Description copied from class: MimeMessage
Writes this message to the specified stream in RFC 822 format.

Specified by:
writeTo in interface Part
Overrides:
writeTo in class MimeMessage
Throws:
java.io.IOException - if an error occurs writing to the stream or in the data handler layer
MessagingException - if an error occurs fetching the data to be written

writeTo

public void writeTo(java.io.OutputStream msgStream,
                    java.lang.String[] ignoreList)
             throws java.io.IOException,
                    MessagingException
Description copied from class: MimeMessage
Writes this message to the specified stream in RFC 822 format, without the specified headers.

Overrides:
writeTo in class MimeMessage
Throws:
java.io.IOException - if an error occurs writing to the stream or in the data handler layer
MessagingException


© Copyright 2003, 2004 The Free Software Foundation, All rights reserved