Top Description Inners Constructors Methods
com.sun.mail.imap

public final Class Utility

extends Object
Class Inheritance
Imports
java.util.Arrays, .Comparator, .ArrayList, .List, javax.mail.*, com.sun.mail.imap.protocol.MessageSet, .UIDSet

Holder for some static utility methods.
Authors
John Mani, Bill Shannon

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
Utility.Condition

This interface defines the test to be executed in toMessageSet().

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public static UIDSet[]

Returns:

the UIDSet array
getResyncUIDSet
(ResyncData
the ResyncData
rd
)

Make the ResyncData UIDSet available to IMAPProtocol, which is in a different package.

public static MessageSet[]

Returns:

the MessageSet array
toMessageSet
(Message[]
the messages
msgs
,
Utility.Condition
the condition to check
cond
)

Run thru the given array of messages, apply the given Condition on each message and generate sets of contiguous sequence-numbers for the successful messages.

public static MessageSet[]

Returns:

the MessageSet array
toMessageSetSorted
(Message[]
the messages
msgs
,
Utility.Condition
the condition to check
cond
)

Sort (a copy of) the given array of messages and then run thru the sorted array of messages, apply the given Condition on each message and generate sets of contiguous sequence-numbers for the successful messages.

public static UIDSet[]

Returns:

the UIDSet array
toUIDSet
(Message[]
the messages
msgs
)

Return UIDSets for the messages.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Utilityback to summary
private Utility()

Method Detail

getResyncUIDSetback to summary
public static UIDSet[] getResyncUIDSet(ResyncData rd)

Make the ResyncData UIDSet available to IMAPProtocol, which is in a different package. Note that this class is not included in the public javadocs, thus "hiding" this method.

Parameters
rd:ResyncData

the ResyncData

Returns:UIDSet[]

the UIDSet array

Since
JavaMail 1.5.1
toMessageSetback to summary
public static MessageSet[] toMessageSet(Message[] msgs, Utility.Condition cond)

Run thru the given array of messages, apply the given Condition on each message and generate sets of contiguous sequence-numbers for the successful messages. If a message in the given array is found to be expunged, it is ignored. ASSERT: Since this method uses and returns message sequence numbers, you should use this method only when holding the messageCacheLock.

Parameters
msgs:Message[]

the messages

cond:Utility.Condition

the condition to check

Returns:MessageSet[]

the MessageSet array

toMessageSetSortedback to summary
public static MessageSet[] toMessageSetSorted(Message[] msgs, Utility.Condition cond)

Sort (a copy of) the given array of messages and then run thru the sorted array of messages, apply the given Condition on each message and generate sets of contiguous sequence-numbers for the successful messages. If a message in the given array is found to be expunged, it is ignored. ASSERT: Since this method uses and returns message sequence numbers, you should use this method only when holding the messageCacheLock.

Parameters
msgs:Message[]

the messages

cond:Utility.Condition

the condition to check

Returns:MessageSet[]

the MessageSet array

Since
JavaMail 1.5.4
toUIDSetback to summary
public static UIDSet[] toUIDSet(Message[] msgs)

Return UIDSets for the messages. Note that the UIDs must have already been fetched for the messages.

Parameters
msgs:Message[]

the messages

Returns:UIDSet[]

the UIDSet array

com.sun.mail.imap back to summary

public Interface Utility.Condition

Known Direct Implementers
com.sun.mail.imap.IMAPMessage.FetchProfileCondition

This interface defines the test to be executed in toMessageSet().

Method Summary

Modifier and TypeMethod and Description
public boolean
test(IMAPMessage message)

Method Detail

testback to summary
public boolean test(IMAPMessage message)