public class ExtendedUUID extends UUID
UUID
accommodating additional data such as a flag and a small hashmap. There may be many instances
in memory, and as they are serialized a lot and sent across the wire, I tried to make this as compact as possible.
As a consequence, the hashmap can have a max size of 255 and a value can have a max length of 255 bytes.限定符和类型 | 字段和说明 |
---|---|
static short |
can_become_site_master |
protected short |
flags |
protected byte[][] |
keys |
static short |
site_master |
protected byte[][] |
values |
cache, leastSigBits, mostSigBits, numberGenerator, print_function, print_uuids, SIZE
限定符 | 构造器和说明 |
---|---|
|
ExtendedUUID() |
protected |
ExtendedUUID(byte[] data) |
|
ExtendedUUID(ExtendedUUID other) |
|
ExtendedUUID(long mostSigBits,
long leastSigBits) |
限定符和类型 | 方法和说明 |
---|---|
ExtendedUUID |
addContents(ExtendedUUID other) |
ExtendedUUID |
clearFlag(short flag) |
protected java.lang.String |
flagsToString() |
byte[] |
get(byte[] key) |
byte[] |
get(java.lang.String key) |
boolean |
isFlagSet(short flag) |
boolean |
keyExists(byte[] key) |
boolean |
keyExists(java.lang.String key) |
int |
length()
The number of non-null keys
|
java.lang.String |
print() |
ExtendedUUID |
put(byte[] key,
byte[] val) |
protected ExtendedUUID |
put(int start_index,
byte[] key,
byte[] val) |
ExtendedUUID |
put(java.lang.String key,
byte[] val) |
static ExtendedUUID |
randomUUID() |
static ExtendedUUID |
randomUUID(java.lang.String name) |
protected void |
read(java.io.DataInput in) |
void |
readExternal(java.io.ObjectInput in) |
void |
readFrom(java.io.DataInput in)
Read the state of the current object (including superclasses) from instream
Note that the input stream must not be closed
|
byte[] |
remove(byte[] key) |
byte[] |
remove(java.lang.String key) |
protected void |
resize(int new_length) |
ExtendedUUID |
setFlag(short flag) |
int |
size()
The number of bytes required to serialize this instance
|
protected int |
sizeofHashMap() |
java.lang.String |
toString() |
protected void |
write(java.io.DataOutput out) |
void |
writeExternal(java.io.ObjectOutput out) |
void |
writeTo(java.io.DataOutput out)
Write the entire state of the current object (including superclasses) to outstream.
|
add, add, compareTo, copy, digits, equals, fromString, generateRandomBytes, get, getByName, getContents, getLeastSignificantBits, getMostSignificantBits, hashCode, printCache, remove, removeAll, retainAll, toStringLong
protected short flags
protected byte[][] keys
protected byte[][] values
public static final short site_master
public static final short can_become_site_master
public ExtendedUUID()
protected ExtendedUUID(byte[] data)
public ExtendedUUID(long mostSigBits, long leastSigBits)
public ExtendedUUID(ExtendedUUID other)
public static ExtendedUUID randomUUID()
public static ExtendedUUID randomUUID(java.lang.String name)
public ExtendedUUID setFlag(short flag)
public ExtendedUUID clearFlag(short flag)
public boolean isFlagSet(short flag)
public byte[] get(byte[] key)
public byte[] get(java.lang.String key)
public ExtendedUUID put(byte[] key, byte[] val)
protected ExtendedUUID put(int start_index, byte[] key, byte[] val)
public ExtendedUUID put(java.lang.String key, byte[] val)
public byte[] remove(byte[] key)
public byte[] remove(java.lang.String key)
public boolean keyExists(byte[] key)
public boolean keyExists(java.lang.String key)
public ExtendedUUID addContents(ExtendedUUID other)
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException
writeExternal
在接口中 java.io.Externalizable
writeExternal
在类中 UUID
java.io.IOException
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException
readExternal
在接口中 java.io.Externalizable
readExternal
在类中 UUID
java.io.IOException
java.lang.ClassNotFoundException
public void writeTo(java.io.DataOutput out) throws java.lang.Exception
Streamable
writeTo
在接口中 Streamable
writeTo
在类中 UUID
java.lang.Exception
public void readFrom(java.io.DataInput in) throws java.lang.Exception
Streamable
readFrom
在接口中 Streamable
readFrom
在类中 UUID
java.lang.Exception
public int size()
public int length()
public java.lang.String print()
protected void write(java.io.DataOutput out) throws java.io.IOException
java.io.IOException
protected void read(java.io.DataInput in) throws java.io.IOException
java.io.IOException
protected int sizeofHashMap()
protected void resize(int new_length)
protected java.lang.String flagsToString()