Module jakarta.mail

Class Utility


  • public final class Utility
    extends java.lang.Object
    Holder for some static utility methods.
    Author:
    John Mani, Bill Shannon
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  Utility.Condition
      This interface defines the test to be executed in toMessageSet().
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static UIDSet[] getResyncUIDSet​(ResyncData rd)
      Make the ResyncData UIDSet available to IMAPProtocol, which is in a different package.
      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.
      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.
      static UIDSet[] toUIDSet​(Message[] msgs)
      Return UIDSets for the messages.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • toMessageSet

        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 - the messages
        cond - the condition to check
        Returns:
        the MessageSet array
      • toMessageSetSorted

        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 - the messages
        cond - the condition to check
        Returns:
        the MessageSet array
        Since:
        JavaMail 1.5.4
      • toUIDSet

        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 - the messages
        Returns:
        the UIDSet array
      • getResyncUIDSet

        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 - the ResyncData
        Returns:
        the UIDSet array
        Since:
        JavaMail 1.5.1