Package com.fasterxml.uuid.impl
Class UUIDUtil
java.lang.Object
com.fasterxml.uuid.impl.UUIDUtil
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
static final int
static final int
static final int
static final int
static final int
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic byte[]
asByteArray
(UUID uuid) static UUID
constructUUID
(UUIDType type, byte[] uuidBytes) Helper method for constructing UUID instances with appropriate typestatic UUID
constructUUID
(UUIDType type, long l1, long l2) static long
extractTimestamp
(UUID uuid) Extract 64-bit timestamp from time-based UUIDs (if time-based type); returns 0 for other types.protected static final long
gatherLong
(byte[] buffer, int offset) static long
initUUIDFirstLong
(long l1, int rawType) static long
initUUIDFirstLong
(long l1, UUIDType type) static long
initUUIDSecondLong
(long l2) static UUID
maxUUID()
Accessor for so-call "Max UUID" (see RFC-9562, #5.10); one that is all one bitsstatic UUID
nilUUID()
Accessor for so-call "Nil UUID" (see RFC 9562, #5.9; one that is all zeroes.static void
toByteArray
(UUID uuid, byte[] buffer) static void
toByteArray
(UUID uuid, byte[] buffer, int offset) static UUIDType
Method for determining which type of UUID given UUID is.static UUID
uuid
(byte[] bytes) Factory method for constructingUUID
instance from given 16 bytes.static UUID
uuid
(byte[] bytes, int offset) Factory method for constructingUUID
instance from given 16 bytes.static UUID
Factory method for creating UUIDs from the canonical string representation.
-
Field Details
-
BYTE_OFFSET_CLOCK_LO
public static final int BYTE_OFFSET_CLOCK_LO- See Also:
-
BYTE_OFFSET_CLOCK_MID
public static final int BYTE_OFFSET_CLOCK_MID- See Also:
-
BYTE_OFFSET_CLOCK_HI
public static final int BYTE_OFFSET_CLOCK_HI- See Also:
-
BYTE_OFFSET_TYPE
public static final int BYTE_OFFSET_TYPE- See Also:
-
BYTE_OFFSET_CLOCK_SEQUENCE
public static final int BYTE_OFFSET_CLOCK_SEQUENCE- See Also:
-
BYTE_OFFSET_VARIATION
public static final int BYTE_OFFSET_VARIATION- See Also:
-
-
Constructor Details
-
UUIDUtil
public UUIDUtil()
-
-
Method Details
-
nilUUID
Accessor for so-call "Nil UUID" (see RFC 9562, #5.9; one that is all zeroes.- Returns:
- "Nil" UUID instance
- Since:
- 4.1
-
maxUUID
Accessor for so-call "Max UUID" (see RFC-9562, #5.10); one that is all one bits- Returns:
- "Nil" UUID instance
- Since:
- 4.1
-
uuid
Factory method for creating UUIDs from the canonical string representation.- Parameters:
id
- String that contains the canonical representation of the UUID to build; 36-char string (see UUID specs for details). Hex-chars may be in upper-case too; UUID class will always output them in lowercase.
-
uuid
Factory method for constructingUUID
instance from given 16 bytes. NOTE: since absolutely no validation is done for contents, this method should only be used if contents are known to be valid. -
uuid
Factory method for constructingUUID
instance from given 16 bytes. NOTE: since absolutely no validation is done for contents, this method should only be used if contents are known to be valid.- Parameters:
bytes
- Array that contains sequence of 16 bytes that contain a valid UUIDoffset
- Offset of the first of 16 bytes
-
constructUUID
Helper method for constructing UUID instances with appropriate type -
constructUUID
-
initUUIDFirstLong
-
initUUIDFirstLong
public static long initUUIDFirstLong(long l1, int rawType) -
initUUIDSecondLong
public static long initUUIDSecondLong(long l2) -
typeOf
Method for determining which type of UUID given UUID is. Returns null if type can not be determined.- Parameters:
uuid
- UUID to check- Returns:
- Null if UUID is null or type can not be determined (== invalid UUID); otherwise type
-
asByteArray
-
toByteArray
-
toByteArray
-
gatherLong
protected static final long gatherLong(byte[] buffer, int offset) -
extractTimestamp
Extract 64-bit timestamp from time-based UUIDs (if time-based type); returns 0 for other types.- Parameters:
uuid
- uuid timestamp to extract from- Returns:
- Unix timestamp in milliseconds (since Epoch), or 0 if type does not support timestamps
- Since:
- 5.0
-