public class UUID extends Object implements Address, Streamable, Comparable<Address>
Modifier and Type | Field and Description |
---|---|
protected byte[] |
additional_data |
protected static LazyRemovalCache<Address,String> |
cache
Keeps track of associations between logical addresses (UUIDs) and logical names
|
protected long |
leastSigBits |
protected long |
mostSigBits |
protected static SecureRandom |
numberGenerator
The random number generator used by this class to create random based UUIDs
|
protected static LazyRemovalCache.Printable<Address,String> |
print_function |
protected static boolean |
print_uuids |
protected static int |
SIZE |
Modifier | Constructor and Description |
---|---|
|
UUID() |
protected |
UUID(byte[] data)
Private constructor which uses a byte array to construct the new UUID
|
|
UUID(long mostSigBits,
long leastSigBits) |
Modifier and Type | Method and Description |
---|---|
static void |
add(Address uuid,
String logical_name) |
static void |
add(Map<Address,String> map) |
Object |
clone() |
int |
compareTo(Address other)
Compares this UUID with the specified UUID.
|
protected static String |
digits(long val,
int digits)
Returns val represented by the specified number of hex digits.
|
boolean |
equals(Object obj)
Compares this object to the specified object.
|
static String |
get(Address logical_addr) |
byte[] |
getAdditionalData()
Deprecated.
Will be removed in 3.0. This was only added to be backwards compatible with 2.7
|
static Map<Address,String> |
getContents()
Returns a copy of the cache's contents
|
long |
getLeastSignificantBits() |
long |
getMostSignificantBits()
Returns the most significant 64 bits of this UUID's 128 bit value.
|
int |
hashCode()
Returns a hash code for this
UUID . |
boolean |
isMulticastAddress()
Checks whether this is an address that represents multiple destinations;
e.g., a class D address in the Internet.
|
static String |
printCache() |
static UUID |
randomUUID()
Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
|
void |
readExternal(ObjectInput in) |
void |
readFrom(DataInputStream in)
Read the state of the current object (including superclasses) from instream
Note that the input stream must not be closed
|
static void |
remove(Address addr) |
static void |
removeAll(Collection<Address> mbrs) |
static void |
retainAll(Collection<Address> logical_addrs) |
void |
setAdditionalData(byte[] additional_data)
Deprecated.
Will be removed in 3.0. This was only added to be backwards compatible with 2.7
|
int |
size()
Returns serialized size of this address
|
String |
toString() |
String |
toStringLong()
Returns a
String object representing this UUID . |
void |
writeExternal(ObjectOutput out) |
void |
writeTo(DataOutputStream out)
Write the entire state of the current object (including superclasses) to outstream.
|
protected long mostSigBits
protected long leastSigBits
protected byte[] additional_data
protected static volatile SecureRandom numberGenerator
protected static LazyRemovalCache<Address,String> cache
protected static boolean print_uuids
protected static final int SIZE
protected static final LazyRemovalCache.Printable<Address,String> print_function
public UUID()
public UUID(long mostSigBits, long leastSigBits)
protected UUID(byte[] data)
public static void remove(Address addr)
public static void removeAll(Collection<Address> mbrs)
public static void retainAll(Collection<Address> logical_addrs)
public static String printCache()
public final byte[] getAdditionalData()
public final void setAdditionalData(byte[] additional_data)
additional_data
- The additional_data to setpublic static UUID randomUUID()
UUID
is generated using a cryptographically strong pseudo
random number generator.UUID
public long getLeastSignificantBits()
public long getMostSignificantBits()
public String toStringLong()
String
object representing this UUID
.
The UUID string representation is as described by this BNF:
UUID = <time_low> "-" <time_mid> "-" <time_high_and_version> "-" <variant_and_sequence> "-" <node> time_low = 4*<hexOctet> time_mid = 2*<hexOctet> time_high_and_version = 2*<hexOctet> variant_and_sequence = 2*<hexOctet> node = 6*<hexOctet> hexOctet = <hexDigit><hexDigit> hexDigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" | "a" | "b" | "c" | "d" | "e" | "f" | "A" | "B" | "C" | "D" | "E" | "F"
UUID
protected static String digits(long val, int digits)
public int hashCode()
UUID
.public boolean equals(Object obj)
true
if and only if the argument is not null
, is a UUID
object, has the same variant, and contains the same value, bit for bit,
as this UUID
.public int compareTo(Address other)
The first of two UUIDs is greater than the second if the most significant field in which the UUIDs differ is greater for the first UUID.
compareTo
in interface Comparable<Address>
other
- UUID
to which this UUID
is to be comparedUUID
is less than, equal to, or greater than val
public void writeTo(DataOutputStream out) throws IOException
Streamable
writeTo
in interface Streamable
IOException
public void readFrom(DataInputStream in) throws IOException, IllegalAccessException, InstantiationException
Streamable
readFrom
in interface Streamable
IOException
IllegalAccessException
InstantiationException
public boolean isMulticastAddress()
Address
isMulticastAddress
in interface Address
public int size()
Address
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
public void writeExternal(ObjectOutput out) throws IOException
writeExternal
in interface Externalizable
IOException
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal
in interface Externalizable
IOException
ClassNotFoundException
Copyright © 2013 JBoss, a division of Red Hat. All Rights Reserved.