UIDFolder (Java EE 5 SDK)

Java

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


javax.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 http://www.ietf.org/rfc/rfc2060.txt for more information.

作者:
John Mani

嵌套类摘要
static class UIDFolder.FetchProfileItem
          A fetch profile item for fetching UIDs.
 
字段摘要
static long LASTUID
          This is a special value that can be used as the end parameter in getMessagesByUID(start, end), to denote the UID of the last message in the folder.
 
方法摘要
 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.
 

字段详细信息

LASTUID

static final long LASTUID
This is a special value that can be used as the end parameter in getMessagesByUID(start, end), to denote the UID of the last message in the folder.

另请参见:
getMessagesByUID(long, long), 常量字段

方法详细信息

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.

返回:
UIDValidity
抛出异常:
MessagingException

getMessageByUID

Message getMessageByUID(long uid)
                        throws MessagingException
Get the Message corresponding to the given UID. If no such message exists, null is returned.

参数:
uid - UID for the desired message
返回:
the Message object. null is returned if no message corresponding to this UID is obtained.
抛出异常:
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 the end parameter to indicate the UID of the last message in the folder.

参数:
start - start UID
end - end UID
返回:
array of Message objects
抛出异常:
MessagingException
另请参见:
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.

参数:
uids - array of UIDs
返回:
array of Message objects
抛出异常:
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.

参数:
message - Message from this folder
返回:
UID for this message
抛出异常:
NoSuchElementException - if the given Message is not in this Folder.
MessagingException

Java EE 5 SDK

深圳电信培训中心.徐海蛟老师.


提交错误或意见

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。深圳电信培训中心.徐海蛟老师教学参考.