Top Description Fields Constructors Methods
javax.mail.internet

pack-priv Class UniqueValue

extends Object
Class Inheritance
Imports
java.net.*, java.util.concurrent.atomic.AtomicInteger, javax.mail.Session

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.

Authors
John Mani, Max Spivak, Bill Shannon

Field Summary

Modifier and TypeField and Description
private static AtomicInteger
id

A global unique number, to ensure uniqueness of generated strings.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
public static String
getUniqueBoundaryValue()

Get a unique value for use in a multipart boundary string.

public static String
getUniqueMessageIDValue(Session
Session object used to get the local address
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().

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

idback to summary
private static AtomicInteger id

A global unique number, to ensure uniqueness of generated strings.

Constructor Detail

UniqueValueback to summary
pack-priv UniqueValue()

Method Detail

getUniqueBoundaryValueback to summary
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).

getUniqueMessageIDValueback to summary
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

Session object used to get the local address

See Also
javax.mail.internet.InternetAddress