public class UUID extends java.lang.Object implements Address, Streamable, java.lang.Comparable<Address>
| Modifier and Type | Field and Description |
|---|---|
protected byte[] |
additional_data |
protected static LazyRemovalCache<Address,java.lang.String> |
cache
Keeps track of associations between logical addresses (UUIDs) and logical names
|
protected long |
leastSigBits |
protected long |
mostSigBits |
protected static java.security.SecureRandom |
numberGenerator
The random number generator used by this class to create random based UUIDs
|
protected static LazyRemovalCache.Printable<Address,java.lang.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,
java.lang.String logical_name) |
static void |
add(java.util.Map<Address,java.lang.String> map) |
java.lang.Object |
clone() |
int |
compareTo(Address other)
Compares this UUID with the specified UUID.
|
protected static java.lang.String |
digits(long val,
int digits)
Returns val represented by the specified number of hex digits.
|
boolean |
equals(java.lang.Object obj)
Compares this object to the specified object.
|
static java.lang.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 java.util.Map<Address,java.lang.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 java.lang.String |
printCache() |
static UUID |
randomUUID()
Static factory to retrieve a type 4 (pseudo randomly generated) UUID.
|
void |
readExternal(java.io.ObjectInput in) |
void |
readFrom(java.io.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(java.util.Collection<Address> mbrs) |
static void |
retainAll(java.util.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
|
java.lang.String |
toString() |
java.lang.String |
toStringLong()
Returns a
String object representing this UUID. |
void |
writeExternal(java.io.ObjectOutput out) |
void |
writeTo(java.io.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 java.security.SecureRandom numberGenerator
protected static LazyRemovalCache<Address,java.lang.String> cache
protected static boolean print_uuids
protected static final int SIZE
protected static final LazyRemovalCache.Printable<Address,java.lang.String> print_function
public UUID()
public UUID(long mostSigBits,
long leastSigBits)
protected UUID(byte[] data)
public static void add(Address uuid, java.lang.String logical_name)
public static void add(java.util.Map<Address,java.lang.String> map)
public static java.lang.String get(Address logical_addr)
public static java.util.Map<Address,java.lang.String> getContents()
public static void remove(Address addr)
public static void removeAll(java.util.Collection<Address> mbrs)
public static void retainAll(java.util.Collection<Address> logical_addrs)
public static java.lang.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.UUIDpublic long getLeastSignificantBits()
public long getMostSignificantBits()
public java.lang.String toString()
toString in class java.lang.Objectpublic java.lang.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"
UUIDprotected static java.lang.String digits(long val,
int digits)
public int hashCode()
UUID.hashCode in class java.lang.ObjectUUIDpublic boolean equals(java.lang.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.equals in class java.lang.Objectobj - The object to be comparedtrue if the objects are the same; false otherwisepublic 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 java.lang.Comparable<Address>other - UUID to which this UUID is to be comparedUUID is less than, equal to, or greater than valpublic void writeTo(java.io.DataOutputStream out)
throws java.io.IOException
StreamablewriteTo in interface Streamablejava.io.IOExceptionpublic void readFrom(java.io.DataInputStream in)
throws java.io.IOException,
java.lang.IllegalAccessException,
java.lang.InstantiationException
StreamablereadFrom in interface Streamablejava.io.IOExceptionjava.lang.IllegalAccessExceptionjava.lang.InstantiationExceptionpublic boolean isMulticastAddress()
AddressisMulticastAddress in interface Addresspublic int size()
Addresspublic java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in class java.lang.Objectjava.lang.CloneNotSupportedExceptionpublic void writeExternal(java.io.ObjectOutput out)
throws java.io.IOException
writeExternal in interface java.io.Externalizablejava.io.IOExceptionpublic void readExternal(java.io.ObjectInput in)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.Externalizablejava.io.IOExceptionjava.lang.ClassNotFoundExceptionCopyright ? 1998-2009 Bela Ban / Red Hat. All Rights Reserved.