Package com.day.util
Class UUID
java.lang.Object
com.day.util.UUID
- All Implemented Interfaces:
Serializable
A Universally Unique Identifier (UUID) is a 128 bit number generated
according to an algorithm that is garanteed to be unique in time and
space from all other UUIDs. It consists of an IEEE 802 Internet Address
and various time stamps to ensure uniqueness. For a complete
specification, see
http://www.ietf.org/internet-drafts/draft-mealling-uuid-urn-05.txt
- Since:
- antbear Audience wad
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionUUID()Generates a random UUID (version 4)UUID(byte[] bytes) Creates a UUID from a byte array.UUID(byte[] node, long time, short clock) Generate a time-based UUID for this host (version 1).UUID(long[] longs) Creates a UUID from 2 longsGenerates a UUID from a string.Create a name base UUID (version 3) -
Method Summary
Modifier and TypeMethodDescriptionstatic UUIDcreate()Generate a UUID for this host using version 1 of [leach]booleanCompare two UUIDsbyte[]getBytes()Returns the bytes of the uuidintGet the UUID version number.inthashCode()Returns a hash code value for the object.static voidInitialize the UUID generator.toString()Provide a String representation of a UUID as specified in section 3.5 of [leach].
-
Field Details
-
hexDigits
public static final char[] hexDigitshexdigits for toString
-
-
Constructor Details
-
UUID
Generates a UUID from a string. the string must have the form. the version is set accoridingly. "00000000-0000-0000-0000-000000000000"- Parameters:
string- the string to use
-
UUID
public UUID(byte[] bytes) Creates a UUID from a byte array.- Parameters:
bytes- the byte array
-
UUID
public UUID(long[] longs) Creates a UUID from 2 longs- Parameters:
longs- the 2 longs
-
UUID
Create a name base UUID (version 3) -
UUID
public UUID()Generates a random UUID (version 4) -
UUID
public UUID(byte[] node, long time, short clock) Generate a time-based UUID for this host (version 1).Field Data Type Octet# Note time_low unsigned 32 0-3 The low field of the bit integer timestamp. time_mid unsigned 16 4-5 The middle field of the bit integer timestamp. time_hi_and_version unsigned 16 6-7 The high field of the bit integer timestamp multiplexed with the version number. clock_seq_hi_and_rese unsigned 8 8 The high field of the rved bit integer clock sequence multiplexed with the variant. clock_seq_low unsigned 8 9 The low field of the bit integer clock sequence. node unsigned 48 10-15 The spatially unique bit integer node identifier.- Parameters:
node- the nodetime- the timeclock- the clock
-
-
Method Details
-
getVersion
public int getVersion()Get the UUID version number.- Returns:
- the version
-
equals
Compare two UUIDs -
toString
Provide a String representation of a UUID as specified in section 3.5 of [leach]. it has this format: "00000000-0000-0000-0000-000000000000" -
getBytes
public byte[] getBytes()Returns the bytes of the uuid- Returns:
- the bytes
-
hashCode
public int hashCode()Returns a hash code value for the object. This method is supported for the benefit of hashtables such as those provided byjava.util.Hashtable. -
init
Initialize the UUID generator.- Parameters:
uuidStateFile- the to read/write the state from
-
create
Generate a UUID for this host using version 1 of [leach]- Returns:
- the UUID
-