public final class UUID extends Object implements Serializable, Comparable
Constructor and Description |
---|
UUID(long mostSigBits,
long leastSigBits)
Constructs a new UUID.
|
Modifier and Type | Method and Description |
---|---|
int |
clockSequence()
Returns the clock-sequence value of this UUID.
|
int |
compareTo(Object obj)
Compare this UUID to another.
|
boolean |
equals(Object obj)
Compare a (UUID) object to this one
|
static UUID |
fromString(String name)
Creates a UUID object from a Sting representation.
|
long |
getLeastSignificantBits()
Returns the least significant 64 bits of the UUID as a
long . |
long |
getMostSignificantBits()
Returns the most significant 64 bits of the UUID as a
long . |
int |
hashCode()
Returns a hash of this UUID.
|
static UUID |
nameUUIDFromBytes(byte[] name)
Creates a UUID version 3 object (name based with MD5 hashing)
from a series of bytes representing a name.
|
long |
node()
Returns the 48-bit node value in a long.
|
static UUID |
randomUUID()
Generate a Leach-Salz (Variant 2) randomly generated (version 4)
UUID.
|
long |
timestamp()
Returns the 60-bit timestamp value of the UUID in a long.
|
String |
toString()
Returns a String representation of the UUID.
|
int |
variant()
Returns the variant of the UUID
This may be:
0 = Reserved for NCS backwards-compatibility
2 = Leach-Salz (supports the other methods in this class)
6 = Reserved for Microsoft backwards-compatibility
7 = (reserved for future use)
|
int |
version()
Returns the version # of the UUID.
|
public UUID(long mostSigBits, long leastSigBits)
public int clockSequence()
UnsupportedOperationException
- if the UUID type is not 1.public int compareTo(Object obj)
compareTo
in interface Comparable
public boolean equals(Object obj)
public static UUID fromString(String name)
toString()
public String toString()
public long getLeastSignificantBits()
long
.public long getMostSignificantBits()
long
.public static UUID nameUUIDFromBytes(byte[] name)
public long node()
UnsupportedOperationException
- if the UUID type is not 1.public long timestamp()
UnsupportedOperationException
- if the UUID type is not 1.public static UUID randomUUID()
public int variant()
public int version()