public final class RandomId extends Object implements Serializable
A globally unique identifier for objects.
Consists of 12 bytes, divided as follows:
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |
| time | random long | ||||||||||
Instances of this class are immutable.
| Modifier and Type | Field and Description |
|---|---|
static long |
OFFSET_SECONDS |
long |
random |
int |
timestamp |
| Constructor and Description |
|---|
RandomId(io.netty.buffer.ByteBuf buffer) |
RandomId(int timestamp,
long random) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj) |
long |
getRandom() |
int |
getTimestamp() |
int |
hashCode() |
static void |
main(String[] args) |
static RandomId |
next()
Gets a new object id.
|
String |
toHexString() |
String |
toHexString32()
128位编码, 长度为32, 前8个字符用'0'填充
|
String |
toString() |
void |
writeTo(io.netty.buffer.ByteBuf buffer) |
public static final long OFFSET_SECONDS
public final int timestamp
public final long random
public RandomId(int timestamp,
long random)
public RandomId(io.netty.buffer.ByteBuf buffer)
public static RandomId next()
public static void main(String[] args)
public int getTimestamp()
public long getRandom()
public void writeTo(io.netty.buffer.ByteBuf buffer)
public String toHexString()
public String toHexString32()
Copyright © 2019. All rights reserved.