📅  最后修改于: 2020-11-14 06:38:45             🧑  作者: Mango
java.util.UUID类表示一个不可变的通用唯一标识符(UUID)。以下是有关UUID的要点-
UUID表示一个128位的值。
它用于创建随机文件名,Web应用程序中的会话ID,事务ID等。
UUID有四种不同的基本类型:基于时间的,DCE安全性,基于名称的和随机生成的UUID。
以下是java.util.UUID类的声明-
public final class UUID
extends Object
implements Serializable, Comparable
Sr.No. | Constructor & Description |
---|---|
1 |
UUID(long mostSigBits, long leastSigBits) This constructor constructs a new UUID using the specified data. |
Sr.No. | Method & Description |
---|---|
1 | int clockSequence()
This method shows the clock sequence value associated with this UUID. |
2 | int compareTo(UUID val)
This method compares this UUID with the specified UUID. |
3 | boolean equals(Object obj)
This method compares this object to the specified object. |
4 | static UUID fromString(String name)
This method creates a UUID from the string standard representation. |
5 | long getLeastSignificantBits()
This method returns the least significant 64 bits of this UUID’s 128 bit value. |
6 | long getMostSignificantBits()
This method returns the most significant 64 bits of this UUID’s 128 bit value. |
7 | int hashCode()
This method returns a hash code for this UUID. |
8 | static UUID nameUUIDFromBytes(byte[] name)
Static factory to retrieve a type 3(name based) UUID based on the specified byte array. |
9 | long node()
This method returns the node value associated with this UUID. |
10 | static UUID randomUUID()
Static factory to retrieve a type 4(pseudo randomly generated) UUID. |
11 | long timestamp()
This method returns the timestamp value associated with this UUID. |
12 | String toString()
This method returns the String object representing this UUID. |
13 | int variant()
This method returns the variant number associated with this UUID. |
14 | int version()
This method removes the version number associated with this UUID. |
此类从以下类继承方法-