java.lang.Object | |
↳ | java.util.UUID |
UUID is an immutable representation of a 128-bit universally unique identifier (UUID).
There are multiple, variant layouts of UUIDs, but this class is based upon variant 2 of RFC 4122 , the Leach-Salz variant. This class can be used to model alternate variants, but most of the methods will be unsupported in those cases; see each method for details.
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Constructs an instance with the specified bits. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
The clock sequence value of the version 1, variant 2 UUID as per RFC 4122 . |
||||||||||
|
Compares this UUID to the specified UUID. |
||||||||||
|
Compares this UUID to another object for equality. |
||||||||||
|
Parses a UUID string with the format defined by
|
||||||||||
|
The 64 least significant bits of the UUID. |
||||||||||
|
The 64 most significant bits of the UUID. |
||||||||||
|
Returns a hash value for this UUID that is consistent with the
|
||||||||||
|
Generates a variant 2, version 3 (name-based, MD5-hashed) UUID as per RFC 4122 . |
||||||||||
|
The node value of the version 1, variant 2 UUID as per RFC 4122 . |
||||||||||
|
Generates a variant 2, version 4 (randomly generated number) UUID as per RFC 4122 . |
||||||||||
|
The timestamp value of the version 1, variant 2 UUID as per RFC 4122 . |
||||||||||
|
Returns a string representation of this UUID in the following format, as per RFC 4122 . |
||||||||||
|
The variant of the UUID as per RFC 4122 . |
||||||||||
|
The version of the variant 2 UUID as per RFC 4122 . |
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
|||||||||||
From interface
java.lang.Comparable
|
Constructs an instance with the specified bits.
mostSigBits | The 64 most significant bits of the UUID. |
---|---|
leastSigBits | The 64 least significant bits of the UUID. |
The clock sequence value of the version 1, variant 2 UUID as per RFC 4122 .
long
value.
UnsupportedOperationException |
if
version()
is not 1.
|
---|
Compares this UUID to the specified UUID. The natural ordering of UUIDs is based upon the value of the bits from most significant to least significant.
uuid | the UUID to compare to. |
---|
uuid
.
Compares this UUID to another object for equality. If
object
is not
null
, is a UUID instance, and all bits are equal, then
true
is returned.
object |
the
Object
to compare to.
|
---|
true
if this UUID is equal to
object
or
false
if not.
Parses a UUID string with the format defined by
toString()
.
uuid | the UUID string to parse. |
---|
NullPointerException |
if
uuid
is
null
.
|
---|---|
IllegalArgumentException |
if
uuid
is not formatted correctly.
|
The 64 least significant bits of the UUID.
The 64 most significant bits of the UUID.
Returns a hash value for this UUID that is consistent with the
equals(Object)
method.
int
value.
Generates a variant 2, version 3 (name-based, MD5-hashed) UUID as per RFC 4122 .
name | the name used as byte array to create an UUID. |
---|
The node value of the version 1, variant 2 UUID as per RFC 4122 .
long
value.
UnsupportedOperationException |
if
version()
is not 1.
|
---|
Generates a variant 2, version 4 (randomly generated number) UUID as per RFC 4122 .
The timestamp value of the version 1, variant 2 UUID as per RFC 4122 .
long
value.
UnsupportedOperationException |
if
version()
is not 1.
|
---|
Returns a string representation of this UUID in the following format, as per RFC 4122 .
UUID = time-low "-" time-mid "-" time-high-and-version "-" clock-seq-and-reserved clock-seq-low "-" node time-low = 4hexOctet time-mid = 2hexOctet time-high-and-version = 2hexOctet clock-seq-and-reserved = hexOctet clock-seq-low = hexOctet node = 6hexOctet hexOctet = hexDigit hexDigit hexDigit = "0" / "1" / "2" / "3" / "4" / "5" / "6" / "7" / "8" / "9" / "a" / "b" / "c" / "d" / "e" / "f" / "A" / "B" / "C" / "D" / "E" / "F"
The variant of the UUID as per RFC 4122 .
int
value.
The version of the variant 2 UUID as per RFC 4122 . If the variant is not 2, then the version will be 0.
nameUUIDFromBytes(byte[])
)
randomUUID()
)
int
value.