Module jakarta.mail
Package jakarta.mail

Interface UIDFolder


public interface UIDFolder
The UIDFolder 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 strictly ascending fashion in the mailbox. That is, 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 value must be greater than the one used in the earlier session.

Refer to RFC 2060 for more information. All the Folder objects returned by the default IMAP provider implement the UIDFolder interface. Use it as follows:


        Folder f = store.getFolder("whatever");
        UIDFolder uf = (UIDFolder)f;
        long uid = uf.getUID(msg);