Module jakarta.mail

Class UniqueValue

java.lang.Object
jakarta.mail.internet.UniqueValue

class UniqueValue extends Object
This is a utility class that generates unique values. The generated String contains only US-ASCII characters and hence is safe for use in RFC822 headers.

This is a package private class.

  • Field Details

    • id

      private static AtomicInteger id
      A global unique number, to ensure uniqueness of generated strings.
  • Constructor Details

    • UniqueValue

      UniqueValue()
  • Method Details

    • getUniqueBoundaryValue

      public static String getUniqueBoundaryValue()
      Get a unique value for use in a multipart boundary string. This implementation generates it by concatenating a global part number, a newly created object's hashCode(), and the current time (in milliseconds).
    • getUniqueMessageIDValue

      public static String getUniqueMessageIDValue(Session ssn)
      Get a unique value for use in a Message-ID. This implementation generates it by concatenating a newly created object's hashCode(), a global ID (incremented on every use), the current time (in milliseconds), and the host name from this user's local address generated by InternetAddress.getLocalAddress(). (The host name defaults to "localhost" if getLocalAddress() returns null.)
      Parameters:
      ssn - Session object used to get the local address
      See Also: