gnu.mail.providers.imap

Class IMAPMessage

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

Nested classes/interfaces inherited from class javax.mail.Message

Message.RecipientType

Field Summary

protected boolean
headersComplete
If set, the current set of headers is complete.
protected String
internalDate
If set, this contains the string value of the received date.
protected static 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

Enumeration
getAllHeaderLines()
Returns all the header-lines.
Enumeration
getAllHeaders()
Returns all the headers.
Object
getContent()
Returns this message's content as a Java object.
protected InputStream
getContentStream()
Returns the raw content stream.
DataHandler
getDataHandler()
Returns a data handler for this message's content.
Flags
getFlags()
Returns the flags for this message.
String[]
getHeader(String name)
Returns the specified header field.
String
getHeader(String name, String delimiter)
Returns the specified header field.
Enumeration
getMatchingHeaderLines(String[] names)
Returns all the header-lines with any of the given names.
Enumeration
getMatchingHeaders(String[] names)
Returns all the headers with any of the given names.
Enumeration
getNonMatchingHeaderLines(String[] names)
Returns all the header-lines without any of the given names.
Enumeration
getNonMatchingHeaders(String[] names)
Returns all the headers without any of the given names.
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(OutputStream msgStream)
Writes this message to the specified stream in RFC 822 format.
void
writeTo(OutputStream msgStream, 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, setFlags, setHeader

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, setExpunged, setFlag, setFlags, setFrom, setFrom, setMessageNumber, setRecipient, setRecipients, setReplyTo, setSentDate, setSubject

Field Details

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.

internalDate

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

internalDateFormat

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

uid

protected long uid
The UID associated with this message.

Method Details

getAllHeaderLines

public Enumeration getAllHeaderLines()
            throws MessagingException
Returns all the header-lines.
Specified by:
getAllHeaderLines in interface MimePart
Overrides:
getAllHeaderLines in interface MimeMessage
Returns:
an Enumeration of Strings

getAllHeaders

public Enumeration getAllHeaders()
            throws MessagingException
Returns all the headers.
Specified by:
getAllHeaders in interface Part
Overrides:
getAllHeaders in interface MimeMessage
Returns:
an Enumeration of Header objects

getContent

public Object getContent()
            throws MessagingException,
                   IOException
Returns this message's content as a Java object.
Specified by:
getContent in interface Part
Overrides:
getContent in interface MimeMessage

getContentStream

protected InputStream getContentStream()
            throws MessagingException
Returns the raw content stream.
Overrides:
getContentStream in interface MimeMessage

getDataHandler

public DataHandler getDataHandler()
            throws MessagingException
Returns a data handler for this message's content.
Specified by:
getDataHandler in interface Part
Overrides:
getDataHandler in interface MimeMessage

getFlags

public Flags getFlags()
            throws MessagingException
Returns the flags for this message.
Overrides:
getFlags in interface MimeMessage

getHeader

public String[] getHeader(String name)
            throws MessagingException
Returns the specified header field.
Specified by:
getHeader in interface Part
Overrides:
getHeader in interface MimeMessage

getHeader

public String getHeader(String name,
                        String delimiter)
            throws MessagingException
Returns the specified header field.
Specified by:
getHeader in interface MimePart
Overrides:
getHeader in interface MimeMessage

getMatchingHeaderLines

public Enumeration getMatchingHeaderLines(String[] names)
            throws MessagingException
Returns all the header-lines with any of the given names.
Specified by:
getMatchingHeaderLines in interface MimePart
Overrides:
getMatchingHeaderLines in interface MimeMessage
Returns:
an Enumeration of Strings

getMatchingHeaders

public Enumeration getMatchingHeaders(String[] names)
            throws MessagingException
Returns all the headers with any of the given names.
Specified by:
getMatchingHeaders in interface Part
Overrides:
getMatchingHeaders in interface MimeMessage
Returns:
an Enumeration of Header objects

getNonMatchingHeaderLines

public Enumeration getNonMatchingHeaderLines(String[] names)
            throws MessagingException
Returns all the header-lines without any of the given names.
Specified by:
getNonMatchingHeaderLines in interface MimePart
Overrides:
getNonMatchingHeaderLines in interface MimeMessage
Returns:
an Enumeration of Strings

getNonMatchingHeaders

public Enumeration getNonMatchingHeaders(String[] names)
            throws MessagingException
Returns all the headers without any of the given names.
Specified by:
getNonMatchingHeaders in interface Part
Overrides:
getNonMatchingHeaders in interface MimeMessage
Returns:
an Enumeration of Header objects

getReceivedDate

public Date getReceivedDate()
            throws MessagingException
Returns the date on which this message was received.
Overrides:
getReceivedDate in interface MimeMessage

isSet

public boolean isSet(Flags.Flag flag)
            throws MessagingException
Indicates whether the specified flag is set in this message.
Overrides:
isSet in interface MimeMessage
Parameters:
flag - the flag

setFlags

public void setFlags(Flags flag,
                     boolean set)
            throws MessagingException
Set the specified flags.
Overrides:
setFlags in interface gnu.mail.providers.ReadOnlyMessage

writeTo

public void writeTo(OutputStream msgStream)
            throws IOException,
                   MessagingException
Writes this message to the specified stream in RFC 822 format.
Specified by:
writeTo in interface Part
Overrides:
writeTo in interface MimeMessage

writeTo

public void writeTo(OutputStream msgStream,
                    String[] ignoreList)
            throws IOException,
                   MessagingException
Writes this message to the specified stream in RFC 822 format, without the specified headers.
Overrides:
writeTo in interface MimeMessage

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