-
public interface UIDFolder
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 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);
- Author:
- John Mani
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface and Description static class
UIDFolder.FetchProfileItem
A fetch profile item for fetching UIDs.
-
Field Summary
Fields Modifier and Type Field and Description static long
LASTUID
This is a special value that can be used as theend
parameter ingetMessagesByUID(start, end)
, to denote the UID of the last message in the folder.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description Message
getMessageByUID(long uid)
Get the Message corresponding to the given UID.Message[]
getMessagesByUID(long[] uids)
Get the Messages specified by the given array of UIDs.Message[]
getMessagesByUID(long start, long end)
Get the Messages specified by the given range.long
getUID(Message message)
Get the UID for the specified message.long
getUIDValidity()
Returns the UIDValidity value associated with this folder.
-
-
-
Field Detail
-
LASTUID
static final long LASTUID
This is a special value that can be used as theend
parameter ingetMessagesByUID(start, end)
, to denote the UID of the last message in the folder.
-
-
Method Detail
-
getUIDValidity
long getUIDValidity() throws MessagingException
Returns the UIDValidity value associated with this folder.Clients typically compare this value against a UIDValidity value saved from a previous session to insure that any cached UIDs are not stale.
- Returns:
- UIDValidity
- Throws:
MessagingException
-
getMessageByUID
Message getMessageByUID(long uid) throws MessagingException
Get the Message corresponding to the given UID. If no such message exists,null
is returned.- Parameters:
uid
- UID for the desired message- Returns:
- the Message object.
null
is returned if no message corresponding to this UID is obtained. - Throws:
MessagingException
-
getMessagesByUID
Message[] getMessagesByUID(long start, long end) throws MessagingException
Get the Messages specified by the given range. The special value LASTUID can be used for theend
parameter to indicate the UID of the last message in the folder.Note that
end
need not be greater thanstart
; the order of the range doesn't matter. Note also that, unless the folder is empty, use of LASTUID ensures that at least one message will be returned - the last message in the folder.- Parameters:
start
- start UIDend
- end UID- Returns:
- array of Message objects
- Throws:
MessagingException
- See Also:
LASTUID
-
getMessagesByUID
Message[] getMessagesByUID(long[] uids) throws MessagingException
Get the Messages specified by the given array of UIDs. If any UID is invalid,null
is returned for that entry.Note that the returned array will be of the same size as the specified array of UIDs, and
null
entries may be present in the array to indicate invalid UIDs.- Parameters:
uids
- array of UIDs- Returns:
- array of Message objects
- Throws:
MessagingException
-
getUID
long getUID(Message message) throws MessagingException
Get the UID for the specified message. Note that the message must belong to this folder. Otherwise java.util.NoSuchElementException is thrown.- Parameters:
message
- Message from this folder- Returns:
- UID for this message
- Throws:
NoSuchElementException
- if the given Message is not in this Folder.MessagingException
-
-
Deutsche Übersetzung
Sie haben gebeten, diese Seite auf Deutsch zu besuchen. Momentan ist nur die Oberfläche übersetzt, aber noch nicht der gesamte Inhalt.Wenn Sie mir bei Übersetzungen helfen wollen, ist Ihr Beitrag willkommen. Alles, was Sie tun müssen, ist, sich auf der Website zu registrieren und mir eine Nachricht zu schicken, in der Sie gebeten werden, Sie der Gruppe der Übersetzer hinzuzufügen, die Ihnen die Möglichkeit gibt, die gewünschten Seiten zu übersetzen. Ein Link am Ende jeder übersetzten Seite zeigt an, dass Sie der Übersetzer sind und einen Link zu Ihrem Profil haben.
Vielen Dank im Voraus.
Dokument erstellt 11/06/2005, zuletzt geändert 18/08/2025
Quelle des gedruckten Dokuments:https://www.gaudry.be/de/java-api-javaee-rf-javax/mail/uidfolder.html
Die Infobro ist eine persönliche Seite, deren Inhalt in meiner alleinigen Verantwortung liegt. Der Text ist unter der CreativeCommons-Lizenz (BY-NC-SA) verfügbar. Weitere Informationen auf die Nutzungsbedingungen und dem Autor.
Referenzen
Diese Verweise und Links verweisen auf Dokumente, die während des Schreibens dieser Seite konsultiert wurden, oder die zusätzliche Informationen liefern können, aber die Autoren dieser Quellen können nicht für den Inhalt dieser Seite verantwortlich gemacht werden.
Der Autor dieser Website ist allein dafür verantwortlich, wie die verschiedenen Konzepte und Freiheiten, die mit den Nachschlagewerken gemacht werden, hier dargestellt werden. Denken Sie daran, dass Sie mehrere Quellinformationen austauschen müssen, um das Risiko von Fehlern zu reduzieren.