public class

MessageCache

extends Object
java.lang.Object
   ↳ com.google.code.com.sun.mail.imap.MessageCache

Class Overview

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.

Summary

Constants
int SLOP Grow the array by at least this much, to avoid constantly reallocating the array.
Fields
private boolean debug
private IMAPFolder folder The folder these messages belong to.
private IMAPMessage[] messages
private PrintStream out
private int[] seqnums
private int size
Public Methods
void addMessages(int count, int newSeqNum)
Add count messages to the cache.
void expungeMessage(int seqnum)
Expunge the message with the given sequence number.
IMAPMessage getMessage(int msgnum)
Get the message object for the indicated message number.
IMAPMessage getMessageBySeqnum(int seqnum)
Get the message object for the indicated sequence number.
IMAPMessage[] removeExpungedMessages()
Remove all the expunged messages from the array, returning a list of removed message objects.
IMAPMessage[] 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.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

private static final int SLOP

Grow the array by at least this much, to avoid constantly reallocating the array.

Constant Value: 64 (0x00000040)

Fields

private boolean debug

private IMAPFolder folder

The folder these messages belong to.

private IMAPMessage[] messages

private PrintStream out

private int[] seqnums

private int size

Public Methods

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
newSeqNum

public void expungeMessage (int seqnum)

Expunge the message with the given sequence number.

Parameters
seqnum

public IMAPMessage getMessage (int msgnum)

Get the message object for the indicated message number. If the message object hasn't been created, create it.

Parameters
msgnum

public IMAPMessage getMessageBySeqnum (int seqnum)

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

public IMAPMessage[] removeExpungedMessages ()

Remove all the expunged messages from the array, returning a list of removed message objects.

public IMAPMessage[] removeExpungedMessages (Message[] msgs)

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

public int seqnumOf (int msgnum)

Return the sequence number for the given message number.

Parameters
msgnum

public int size ()

Size of cache.