|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.hypergraphdb.handle.UUID
public class UUID
NOTE - code adapted from JUG libary (Copyright (c) 2002- Tatu Saloranta, tatu.saloranta@iki.fi). See http://jug.safehaus.org/. This code only support type 4 UUID - randomly generated ones.
| Field Summary | |
|---|---|
static byte |
INDEX_CLOCK_HI
|
static byte |
INDEX_CLOCK_LO
|
static byte |
INDEX_CLOCK_MID
|
static byte |
INDEX_CLOCK_SEQUENCE
|
static byte |
INDEX_TYPE
|
static byte |
INDEX_VARIATION
|
static java.lang.String |
NAMESPACE_DNS
|
static java.lang.String |
NAMESPACE_OID
|
static java.lang.String |
NAMESPACE_URL
|
static java.lang.String |
NAMESPACE_X500
|
static byte |
TYPE_DCE
|
static byte |
TYPE_NAME_BASED
|
static byte |
TYPE_NULL
|
static byte |
TYPE_RANDOM_BASED
|
static byte |
TYPE_TIME_BASED
|
| Constructor Summary | |
|---|---|
UUID()
Default constructor creates a NIL UUID, one that contains all zeroes Note that the clearing of array is actually unnecessary as JVMs are required to clear up the allocated arrays by default. |
|
UUID(byte[] data)
Constructor for cases where you already have the 16-byte binary representation of the UUID (for example if you save UUIDs binary takes less than half of space string representation takes). |
|
UUID(byte[] data,
int start)
Constructor for cases where you already have the binary representation of the UUID (for example if you save UUIDs binary takes less than half of space string representation takes) in a byte array |
|
UUID(java.lang.String id)
Constructor for creating UUIDs from the canonical string representation Note that implementation is optimized for speed, not necessarily code clarity... |
|
| Method Summary | |
|---|---|
byte[] |
asByteArray()
Returns the UUID as a 16-byte byte array |
java.lang.Object |
clone()
Default cloning behaviour (bitwise copy) is just fine... |
int |
compareTo(UUID o)
|
boolean |
equals(java.lang.Object o)
Checking equality of UUIDs is easy; just compare the 128-bit number. |
static UUID |
getNullUUID()
Accessor for getting the shared null UUID |
int |
getType()
Returns the UUID type code |
int |
hashCode()
|
boolean |
isNullUUID()
|
byte[] |
toByteArray()
'Synonym' for 'asByteArray' |
void |
toByteArray(byte[] dst)
|
void |
toByteArray(byte[] dst,
int pos)
Fills in the 16 bytes (from index pos) of the specified byte array with the UUID contents. |
java.lang.String |
toString()
|
static UUID |
valueOf(byte[] src)
Constructs a new UUID instance given a byte array that contains the (16 byte) binary representation. |
static UUID |
valueOf(byte[] src,
int start)
Constructs a new UUID instance given a byte array that contains the (16 byte) binary representation. |
static UUID |
valueOf(java.lang.String id)
Constructs a new UUID instance given the canonical string representation of an UUID. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final byte INDEX_CLOCK_HI
public static final byte INDEX_CLOCK_MID
public static final byte INDEX_CLOCK_LO
public static final byte INDEX_TYPE
public static final byte INDEX_CLOCK_SEQUENCE
public static final byte INDEX_VARIATION
public static final byte TYPE_NULL
public static final byte TYPE_TIME_BASED
public static final byte TYPE_DCE
public static final byte TYPE_NAME_BASED
public static final byte TYPE_RANDOM_BASED
public static final java.lang.String NAMESPACE_DNS
public static final java.lang.String NAMESPACE_URL
public static final java.lang.String NAMESPACE_OID
public static final java.lang.String NAMESPACE_X500
| Constructor Detail |
|---|
public UUID()
public UUID(byte[] data)
data - array that contains the binary representation of UUID
public UUID(byte[] data,
int start)
data - array that contains the binary representation of UUIDstart - byte offset where UUID starts
public UUID(java.lang.String id)
throws java.lang.NumberFormatException
id - String that contains the canonical representation of
the UUID to build; 36-char string (see UUID specs for details).
Hex-chars may be in upper-case too; UUID class will always output
them in lowercase.
java.lang.NumberFormatException| Method Detail |
|---|
public java.lang.Object clone()
clone in class java.lang.Objectpublic static UUID getNullUUID()
public boolean isNullUUID()
public int getType()
public byte[] asByteArray()
public void toByteArray(byte[] dst,
int pos)
dst - Byte array to fillpos - Offset in the arraypublic void toByteArray(byte[] dst)
public byte[] toByteArray()
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String toString()
toString in class java.lang.Objectpublic int compareTo(UUID o)
compareTo in interface java.lang.Comparable<UUID>public boolean equals(java.lang.Object o)
equals in class java.lang.Object
public static UUID valueOf(java.lang.String id)
throws java.lang.NumberFormatException
id - Canonical string representation used for constructing
an UUID instance
java.lang.NumberFormatException - if 'id' is invalid UUID
public static UUID valueOf(byte[] src,
int start)
src - Byte array that contains the UUID definitionstart - Offset in the array where the UUID startspublic static UUID valueOf(byte[] src)
src - Byte array that contains the UUID definition
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||