Package javax.mail.internet
Class UniqueValue
- java.lang.Object
-
- javax.mail.internet.UniqueValue
-
class UniqueValue extends java.lang.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 Summary
Fields Modifier and Type Field Description private static java.util.concurrent.atomic.AtomicInteger
id
A global unique number, to ensure uniqueness of generated strings.
-
Constructor Summary
Constructors Constructor Description UniqueValue()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.lang.String
getUniqueBoundaryValue()
Get a unique value for use in a multipart boundary string.static java.lang.String
getUniqueMessageIDValue(Session ssn)
Get a unique value for use in a Message-ID.
-
-
-
Method Detail
-
getUniqueBoundaryValue
public static java.lang.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'shashCode()
, and the current time (in milliseconds).
-
getUniqueMessageIDValue
public static java.lang.String getUniqueMessageIDValue(Session ssn)
Get a unique value for use in a Message-ID. This implementation generates it by concatenating a newly created object'shashCode()
, a global ID (incremented on every use), the current time (in milliseconds), and the host name from this user's local address generated byInternetAddress.getLocalAddress()
. (The host name defaults to "localhost" ifgetLocalAddress()
returns null.)- Parameters:
ssn
- Session object used to get the local address- See Also:
InternetAddress
-
-