javax.mail

Interface UIDFolder

Known Implementing Classes:
IMAPFolder

public interface UIDFolder

A folder that supports permanent references to messages in the form of a long integer (i.e. an IMAP folder). These UIDs survive the closure and reopening of the message store and session context.

UIDs are assigned to messages in a folder in a strictly ascending fashion; that is, if the message number of message x is greater than the message number of message y, its UID will also be greater than that of y.

Version:
1.4
Author:
Chris Burdess
See Also:
2060 http://www.ietf.org/rfc/rfc2060.txt

Nested Class Summary

static class
UIDFolder.FetchProfileItem
A fetch profile item for fetching UIDs.

Field Summary

static long
LASTUID
This special value can be used as the end parameter in getMessages(start, end) to denote the last UID in this folder.

Method Summary

Message
getMessageByUID(long uid)
Returns the message corresponding to the given UID, or null if no such message exists.
Message[]
getMessagesByUID(long start, long end)
Returns the messages in the given range.
Message[]
getMessagesByUID(long[] uids)
Returns the messages specified by the given UIDs.
long
getUID(Message message)
Returns the UID for the specified message.
long
getUIDValidity()
Returns the UIDValidity value associated with this folder.

Field Details

LASTUID

public static final long LASTUID
This special value can be used as the end parameter in getMessages(start, end) to denote the last UID in this folder.
Field Value:
-1L

Method Details

getMessageByUID

public Message getMessageByUID(long uid)
            throws MessagingException
Returns the message corresponding to the given UID, or null if no such message exists.
Parameters:
uid - the UID of the desired message

getMessagesByUID

public Message[] getMessagesByUID(long start,
                                  long end)
            throws MessagingException
Returns the messages in the given range. The special value LASTUID can be used as the end parameter to indicate the last available UID.
Parameters:
start - the start UID
end - the end UID

getMessagesByUID

public Message[] getMessagesByUID(long[] uids)
            throws MessagingException
Returns the messages specified by the given UIDs. If any UID is invalid, null is returned for that entry.

The returned array will be of the same size as the specified UIDs.

Parameters:
uids - the UIDs

getUID

public long getUID(Message message)
            throws MessagingException
Returns the UID for the specified message.
Parameters:
message - a message in this folder

getUIDValidity

public long getUIDValidity()
            throws MessagingException
Returns the UIDValidity value associated with this folder.

A client should compare this value against a UIDValidity value saved from a previous session to ensure that any cached UIDs are valid.


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