JXTA

net.jxta.impl.id.UUID
Class UUID

java.lang.Object
  extended by net.jxta.impl.id.UUID.UUID
All Implemented Interfaces:
Serializable

public final class UUID
extends Object
implements Serializable

A UUID is a 128-bit universally unique identifier. The most significant long can be decomposed into the following unsigned fields:

 0xFFFFFFFF00000000 time_low
 0x00000000FFFF0000 time_mid
 0x000000000000F000 version
 0x0000000000000FFF time_hi
 

The least significant long can be decomposed into the following unsigned fields:

 0xC000000000000000 variant
 0x3FFF000000000000 clock_seq
 0x0000FFFFFFFFFFFF node
 

The variant field must be 0x2. The version field must be either 0x1 or 0x4.

If the version field is 0x4, then the most significant bit of the node field must be set to 1, and the remaining fields are set to values produced by a cryptographically strong pseudo-random number generator.

If the version field is 0x1, then the node field is set to an IEEE 802 address (MAC), the clock_seq field is set to a 14-bit random number, and the time_low, time_mid, and time_hi fields are set to the least, middle and most significant bits (respectively) of a 60-bit timestamp measured in 100-nanosecond units since midnight, October 15, 1582 UTC.

See Also:
IDFormat, UUIDFactory, "Information Technology - Open Systems Interconnection - Remote Procedure Call (RPC), ISO 11578:1996", The Open Group - DCE 1.1 Remote Procedure Call (RPC) : Appendix A - Universal Unique Identifier, Serialized Form

Field Summary
static UUID nullUUID
          The null UUID.
 
Constructor Summary
UUID(byte[] bytes)
          Simple constructor.
UUID(long mostSig, long leastSig)
          Simple constructor.
UUID(String uuid)
           
 
Method Summary
 boolean equals(Object target)
          
 boolean equals(UUID sid)
          UUIDs are equal if they represent the same 128-bit value.
 long getLeastSignificantBits()
          Returns the least significant 64 bits of the UUID.
 long getMostSignificantBits()
          Returns the most significant 64 bits of the UUID.
 int hashCode()
          
 String toString()
          Returns a 36-character string of six fields separated by hyphens, with each field represented in lowercase hexadecimal with the same number of digits as in the field.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

nullUUID

public static final UUID nullUUID
The null UUID. Useful for comparisons.

Constructor Detail

UUID

public UUID(long mostSig,
            long leastSig)
Simple constructor. This constructor does not check to ensure that the values provided produce a valid UUID.

Parameters:
mostSig - the most significant 64 bits
leastSig - the least significant 64 bits

UUID

public UUID(byte[] bytes)
Simple constructor. This constructor does not check to ensure that the values provided produce a valid UUID.

Parameters:
bytes - the 128 bits of

UUID

public UUID(String uuid)
Method Detail

getMostSignificantBits

public long getMostSignificantBits()
Returns the most significant 64 bits of the UUID.

Returns:
long return most significant bits

getLeastSignificantBits

public long getLeastSignificantBits()
Returns the least significant 64 bits of the UUID.

Returns:
long least significant bits

hashCode

public int hashCode()

Overrides:
hashCode in class Object

equals

public boolean equals(Object target)

Overrides:
equals in class Object

equals

public boolean equals(UUID sid)
UUIDs are equal if they represent the same 128-bit value.

Parameters:
sid - UUID seed
Returns:
boolean true if equals

toString

public String toString()
Returns a 36-character string of six fields separated by hyphens, with each field represented in lowercase hexadecimal with the same number of digits as in the field. The order of fields is: time_low, time_mid, version and time_hi treated as a single field, variant and clock_seq treated as a single field, and node. ie. XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX

Overrides:
toString in class Object
Returns:
String return value

JXSE