TheUIDFolder
interface is implemented by Folders that can support the "disconnected" mode of operation, by providing unique-ids for messages in the folder. This interface is based on the IMAP model for supporting disconnected operation.
A Unique identifier (UID) is a positive long value, assigned to each message in a specific folder. Unique identifiers are assigned in a strictlyascending fashion in the mailbox. i.e, as each message is added to the mailbox it is assigned a higher UID than the message(s) which were added previously. Unique identifiers persist across sessions. This permits a client to resynchronize its state from a previous session with the server.
Associated with every mailbox is a unique identifier validity value. If unique identifiers from an earlier session fail to persist to this session, the unique identifier validity valuemust be greater than the one used in the earlier session.
Refer RFC 2060(http://www.ietf.org/rfc/rfc2060.txt)
for more information.
UIDFolder.FetchProfileItem A fetch profile item for fetching UIDs. |
LASTUID This is a special value that can be used as the end parameter ingetMessages(start, end) , to denote the last UID in this folder. |
getMessageByUID(long uid) Get the Message corresponding to the given UID. | |
getMessagesByUID(long[] uids) Get the Messages specified by the given array of UIDs. | |
getMessagesByUID(long start, long end) Get the Messages specified by the given range. | |
getUID(Message message) Get the UID for the specified message. | |
getUIDValidity() Returns the UIDValidity value associated with this folder. |
public static final longLASTUID
end
parameter ingetMessages(start, end)
, to denote the last UID in this folder.getMessagesByUID(long, long)
public longgetUIDValidity() throwsMessagingException
Clients typically compare this value against a UIDValidity value saved from a previous session to insure that any cached UIDs not stale.
publicMessagegetMessageByUID(long uid) throwsMessagingException
null
is returned.uid
- UID for the desired messagenull
is returnedif no message corresponding to this UID is obtained.MessagingException
- publicMessage[]getMessagesByUID(long start, long end) throwsMessagingException
end
parameter to indicate the last available UID.start
- start UIDend
- end UIDMessagingException
- LASTUID
publicMessage[]getMessagesByUID(long[] uids) throwsMessagingException
null
is returned for that entry. Note that the returned array will be of the same size as the specified array of UIDs, andnull
entries may be present in the array to indicate invalid UIDs.
uids
- array of UIDsMessagingException
- public longgetUID(Message message) throwsMessagingException
message
- Message from this folderjava.util.NoSuchElementException
- if the given Messageis not in this Folder.