Package com.sun.mail.gimap
Class GmailMessage
- java.lang.Object
-
- javax.mail.Message
-
- javax.mail.internet.MimeMessage
-
- com.sun.mail.imap.IMAPMessage
-
- com.sun.mail.gimap.GmailMessage
-
- All Implemented Interfaces:
ReadableMime
,MimePart
,Part
public class GmailMessage extends IMAPMessage
A Gmail message. Adds methods to access Gmail-specific per-message data.- Since:
- JavaMail 1.4.6
- Author:
- Bill Shannon
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.sun.mail.imap.IMAPMessage
IMAPMessage.FetchProfileCondition
-
Nested classes/interfaces inherited from class javax.mail.internet.MimeMessage
MimeMessage.RecipientType
-
-
Field Summary
-
Fields inherited from class com.sun.mail.imap.IMAPMessage
bs, envelope, items, sectionId
-
Fields inherited from class javax.mail.internet.MimeMessage
cachedContent, content, contentStream, dh, flags, headers, modified, saved
-
Fields inherited from interface javax.mail.Part
ATTACHMENT, INLINE
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
GmailMessage(IMAPFolder folder, int msgnum)
Constructor.protected
GmailMessage(Session session)
Constructor, for use by IMAPNestedMessage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
clearCachedLabels()
Clear any cached labels for this message.java.lang.String[]
getLabels()
Return the Gmail labels associated with this message.long
getMsgId()
Return the Gmail unique message ID.long
getThrId()
Return the Gmail unique thread ID.void
setLabels(java.lang.String[] labels, boolean set)
Set/Unset the given labels on this message.-
Methods inherited from class com.sun.mail.imap.IMAPMessage
addFrom, addHeader, addHeaderLine, addRecipients, checkExpunged, fetchItem, forceCheckExpunged, getAllHeaderLines, getAllHeaders, getContentID, getContentLanguage, getContentMD5, getContentStream, getContentType, getDataHandler, getDescription, getDisposition, getEncoding, getFetchBlockSize, getFileName, getFlags, getFrom, getHeader, getHeader, getInReplyTo, getItem, getLineCount, getMatchingHeaderLines, getMatchingHeaders, getMessageCacheLock, getMessageID, getMimeStream, getModSeq, getNonMatchingHeaderLines, getNonMatchingHeaders, getPeek, getProtocol, getReceivedDate, getRecipients, getReplyTo, getSender, getSentDate, getSequenceNumber, getSize, getSizeLong, getSubject, getUID, handleExtensionFetchItems, handleFetchItem, ignoreBodyStructureSize, invalidateHeaders, isREV1, isSet, removeHeader, setContentID, setContentLanguage, setContentMD5, setDataHandler, setDescription, setDisposition, setExpunged, setFileName, setFlags, setFrom, setHeader, setMessageNumber, setPeek, setRecipients, setReplyTo, setSender, setSentDate, setSubject, setUID, writeTo
-
Methods inherited from class javax.mail.internet.MimeMessage
addRecipients, createInternetHeaders, createMimeMessage, getAllRecipients, getContent, getInputStream, getRawInputStream, isMimeType, parse, reply, reply, saveChanges, setContent, setContent, setDescription, setFrom, setFrom, setRecipients, setSubject, setText, setText, setText, updateHeaders, updateMessageID, writeTo
-
Methods inherited from class javax.mail.Message
addRecipient, getFolder, getMessageNumber, getSession, isExpunged, match, setFlag, setRecipient
-
-
-
-
Constructor Detail
-
GmailMessage
protected GmailMessage(IMAPFolder folder, int msgnum)
Constructor.- Parameters:
folder
- the containing foldermsgnum
- the message sequence number
-
GmailMessage
protected GmailMessage(Session session)
Constructor, for use by IMAPNestedMessage.- Parameters:
session
- the Session
-
-
Method Detail
-
getMsgId
public long getMsgId() throws MessagingException
Return the Gmail unique message ID.- Returns:
- the message ID
- Throws:
MessagingException
- for failures
-
getThrId
public long getThrId() throws MessagingException
Return the Gmail unique thread ID.- Returns:
- the thread ID
- Throws:
MessagingException
- for failures
-
getLabels
public java.lang.String[] getLabels() throws MessagingException
Return the Gmail labels associated with this message.- Returns:
- array of labels, or empty array if none
- Throws:
MessagingException
- for failures
-
setLabels
public void setLabels(java.lang.String[] labels, boolean set) throws MessagingException
Set/Unset the given labels on this message.- Parameters:
labels
- the labels to add or removeset
- true to add labels, false to remove- Throws:
MessagingException
- for failures- Since:
- JavaMail 1.5.5
-
clearCachedLabels
public void clearCachedLabels()
Clear any cached labels for this message. The Gmail labels for a messge will be cached when first accessed using either the fetch method or the getLabels method. Gmail provides no notification when the labels have been changed by another application so applications may need to clear the cache if accessing the labels for a message more than once while the Folder is open.- Since:
- JavaMail 1.5.6
-
-