public final class TimeUUIDUtils extends Object
| Constructor and Description |
|---|
TimeUUIDUtils() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
asByteArray(UUID uuid)
As byte array.
|
static ByteBuffer |
asByteBuffer(UUID uuid)
Coverts a java.util.UUID into a ByteBuffer.
|
static long |
getTimeFromUUID(byte[] uuid)
Retrieves the time as long based on the byte[] representation of a UUID.
|
static long |
getTimeFromUUID(UUID uuid) |
static UUID |
getTimeUUID(ClockResolution clock)
Gets a new time uuid using
ClockResolution.createClock() as a time generator. |
static UUID |
getTimeUUID(long time)
Gets a new time uuid based on
time |
static UUID |
getUniqueTimeUUIDinMillis()
Gets a new and unique time uuid in milliseconds.
|
static UUID |
toUUID(byte[] uuid)
Returns an instance of uuid.
|
static UUID |
uuid(byte[] uuid,
int offset) |
static UUID |
uuid(ByteBuffer bb)
Converts a ByteBuffer containing a UUID into a java.util.UUID
|
public static UUID getUniqueTimeUUIDinMillis()
public static UUID getTimeUUID(ClockResolution clock)
ClockResolution.createClock() as a time generator.
It is useful to use in a TimeUUIDType sorted column family.clock - a ClockResolutionpublic static UUID getTimeUUID(long time)
time.
NOTE: this algorithm does not resolve duplicates. To avoid duplicates use
getTimeUUID(ClockResolution clock) with an implementaion that provides unique timestamp resolution, like
MicrosecondsSyncClockResolution
It is useful to use in a TimeUUIDType sorted column family.clock - a ClockResolutionpublic static UUID toUUID(byte[] uuid)
uuid - the uuidpublic static long getTimeFromUUID(byte[] uuid)
uuid - byte[] uuid representationpublic static long getTimeFromUUID(UUID uuid)
public static byte[] asByteArray(UUID uuid)
#getTimeUUID()uuid - the uuidpublic static ByteBuffer asByteBuffer(UUID uuid)
uuid - a java.util.UUIDpublic static UUID uuid(byte[] uuid, int offset)
public static UUID uuid(ByteBuffer bb)
bb - a ByteBuffer containing a UUIDCopyright © 2014. All Rights Reserved.