Package com.sun.mail.imap
Class MessageCache
java.lang.Object
com.sun.mail.imap.MessageCache
A cache of IMAPMessage objects along with the
mapping from message number to IMAP sequence number.
All operations on this object are protected by the messageCacheLock
in IMAPFolder.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addMessages
(int count, int newSeqNum) Add count messages to the cache.void
expungeMessage
(int seqnum) Expunge the message with the given sequence number.getMessage
(int msgnum) Get the message object for the indicated message number.getMessageBySeqnum
(int seqnum) Get the message object for the indicated sequence number.Remove all the expunged messages from the array, returning a list of removed message objects.removeExpungedMessages
(Message[] msgs) Remove expunged messages in msgs from the array, returning a list of removed message objects.int
seqnumOf
(int msgnum) Return the sequence number for the given message number.int
size()
Size of cache.
-
Method Details
-
size
public int size()Size of cache.- Returns:
- the size of the cache
-
getMessage
Get the message object for the indicated message number. If the message object hasn't been created, create it.- Parameters:
msgnum
- the message number- Returns:
- the message
-
getMessageBySeqnum
Get the message object for the indicated sequence number. If the message object hasn't been created, create it. Return null if there's no message with that sequence number.- Parameters:
seqnum
- the sequence number of the message- Returns:
- the message
-
expungeMessage
public void expungeMessage(int seqnum) Expunge the message with the given sequence number.- Parameters:
seqnum
- the sequence number of the message to expunge
-
removeExpungedMessages
Remove all the expunged messages from the array, returning a list of removed message objects.- Returns:
- the removed messages
-
removeExpungedMessages
Remove expunged messages in msgs from the array, returning a list of removed message objects. All messages in msgs must be IMAPMessage objects from this folder.- Parameters:
msgs
- the messages- Returns:
- the removed messages
-
addMessages
public void addMessages(int count, int newSeqNum) Add count messages to the cache. newSeqNum is the sequence number of the first message added.- Parameters:
count
- the number of messgesnewSeqNum
- sequence number of first message
-
seqnumOf
public int seqnumOf(int msgnum) Return the sequence number for the given message number.- Parameters:
msgnum
- the message number- Returns:
- the sequence number
-