Package gnu.mail.providers.imap
Class IMAPMessage
- java.lang.Object
-
- javax.mail.Message
-
- javax.mail.internet.MimeMessage
-
- gnu.mail.providers.ReadOnlyMessage
-
- gnu.mail.providers.imap.IMAPMessage
-
public final class IMAPMessage extends gnu.mail.providers.ReadOnlyMessageThe 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
Fields Modifier and Type Field Description protected booleanheadersCompleteIf set, the current set of headers is complete.protected java.lang.StringinternalDateIf set, this contains the string value of the received date.protected static java.text.DateFormatinternalDateFormatThe date format used to parse IMAP INTERNALDATE values.protected longuidThe UID associated with this message.-
Fields inherited from class javax.mail.internet.MimeMessage
content, contentStream, dh, flags, headers, modified, saved
-
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.EnumerationgetAllHeaderLines()Returns all the header-lines.java.util.EnumerationgetAllHeaders()Returns all the headers.java.lang.ObjectgetContent()Returns this message's content as a Java object.protected java.io.InputStreamgetContentStream()Returns the raw content stream.javax.activation.DataHandlergetDataHandler()Returns a data handler for this message's content.FlagsgetFlags()Returns the flags for this message.java.lang.String[]getHeader(java.lang.String name)Returns the specified header field.java.lang.StringgetHeader(java.lang.String name, java.lang.String delimiter)Returns the specified header field.java.util.EnumerationgetMatchingHeaderLines(java.lang.String[] names)Returns all the header-lines with any of the given names.java.util.EnumerationgetMatchingHeaders(java.lang.String[] names)Returns all the headers with any of the given names.java.util.EnumerationgetNonMatchingHeaderLines(java.lang.String[] names)Returns all the header-lines without any of the given names.java.util.EnumerationgetNonMatchingHeaders(java.lang.String[] names)Returns all the headers without any of the given names.java.util.DategetReceivedDate()Returns the date on which this message was received.booleanisSet(Flags.Flag flag)Indicates whether the specified flag is set in this message.voidsetFlags(Flags flag, boolean set)Set the specified flags.voidwriteTo(java.io.OutputStream msgStream)Writes this message to the specified stream in RFC 822 format.voidwriteTo(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
-
-
-
-
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 MessagingExceptionReturns the date on which this message was received.- Overrides:
getReceivedDatein classMimeMessage- Throws:
MessagingException
-
getDataHandler
public javax.activation.DataHandler getDataHandler() throws MessagingExceptionReturns a data handler for this message's content.- Specified by:
getDataHandlerin interfacePart- Overrides:
getDataHandlerin classMimeMessage- Throws:
MessagingException
-
getContent
public java.lang.Object getContent() throws MessagingException, java.io.IOExceptionDescription copied from class:MimeMessageReturns this message's content as a Java object.- Specified by:
getContentin interfacePart- Overrides:
getContentin classMimeMessage- Throws:
java.io.IOException- if an error occurred in the data handler layerMessagingException
-
getContentStream
protected java.io.InputStream getContentStream() throws MessagingExceptionReturns the raw content stream.- Overrides:
getContentStreamin classMimeMessage- Throws:
MessagingException- See Also:
MimeBodyPart.getContentStream()
-
getHeader
public java.lang.String[] getHeader(java.lang.String name) throws MessagingExceptionReturns the specified header field.- Specified by:
getHeaderin interfacePart- Overrides:
getHeaderin classMimeMessage- Parameters:
name- the header name- Throws:
MessagingException
-
getHeader
public java.lang.String getHeader(java.lang.String name, java.lang.String delimiter) throws MessagingExceptionReturns the specified header field.- Specified by:
getHeaderin interfaceMimePart- Overrides:
getHeaderin classMimeMessage- Parameters:
name- the header namedelimiter- the delimiter- Throws:
MessagingException
-
getAllHeaders
public java.util.Enumeration getAllHeaders() throws MessagingExceptionDescription copied from class:MimeMessageReturns all the headers.- Specified by:
getAllHeadersin interfacePart- Overrides:
getAllHeadersin classMimeMessage- Returns:
- an Enumeration of Header objects
- Throws:
MessagingException
-
getAllHeaderLines
public java.util.Enumeration getAllHeaderLines() throws MessagingExceptionDescription copied from class:MimeMessageReturns all the header-lines.- Specified by:
getAllHeaderLinesin interfaceMimePart- Overrides:
getAllHeaderLinesin classMimeMessage- Returns:
- an Enumeration of Strings
- Throws:
MessagingException
-
getMatchingHeaders
public java.util.Enumeration getMatchingHeaders(java.lang.String[] names) throws MessagingExceptionDescription copied from class:MimeMessageReturns all the headers with any of the given names.- Specified by:
getMatchingHeadersin interfacePart- Overrides:
getMatchingHeadersin classMimeMessage- 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 MessagingExceptionDescription copied from class:MimeMessageReturns all the header-lines with any of the given names.- Specified by:
getMatchingHeaderLinesin interfaceMimePart- Overrides:
getMatchingHeaderLinesin classMimeMessage- Returns:
- an Enumeration of Strings
- Throws:
MessagingException
-
getNonMatchingHeaders
public java.util.Enumeration getNonMatchingHeaders(java.lang.String[] names) throws MessagingExceptionDescription copied from class:MimeMessageReturns all the headers without any of the given names.- Specified by:
getNonMatchingHeadersin interfacePart- Overrides:
getNonMatchingHeadersin classMimeMessage- 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 MessagingExceptionDescription copied from class:MimeMessageReturns all the header-lines without any of the given names.- Specified by:
getNonMatchingHeaderLinesin interfaceMimePart- Overrides:
getNonMatchingHeaderLinesin classMimeMessage- Returns:
- an Enumeration of Strings
- Throws:
MessagingException
-
getFlags
public Flags getFlags() throws MessagingException
Description copied from class:MimeMessageReturns the flags for this message.- Overrides:
getFlagsin classMimeMessage- Throws:
MessagingException
-
isSet
public boolean isSet(Flags.Flag flag) throws MessagingException
Description copied from class:MimeMessageIndicates whether the specified flag is set in this message.- Overrides:
isSetin classMimeMessage- Parameters:
flag- the flag- Throws:
MessagingException
-
setFlags
public void setFlags(Flags flag, boolean set) throws MessagingException
Set the specified flags.- Overrides:
setFlagsin classgnu.mail.providers.ReadOnlyMessage- Parameters:
flag- the flags to be setset- the value to be set- Throws:
IllegalWriteException- if the underlying implementation does not support modification of existing valuesMessagingException
-
writeTo
public void writeTo(java.io.OutputStream msgStream) throws java.io.IOException, MessagingExceptionDescription copied from class:MimeMessageWrites this message to the specified stream in RFC 822 format.- Specified by:
writeToin interfacePart- Overrides:
writeToin classMimeMessage- Throws:
java.io.IOException- if an error occurs writing to the stream or in the data handler layerMessagingException- 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, MessagingExceptionDescription copied from class:MimeMessageWrites this message to the specified stream in RFC 822 format, without the specified headers.- Overrides:
writeToin classMimeMessage- Throws:
java.io.IOException- if an error occurs writing to the stream or in the data handler layerMessagingException
-
-