com.day.util
Class UUID

java.lang.Object
  extended by com.day.util.UUID
All Implemented Interfaces:
Serializable

public class UUID
extends Object
implements 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
Version:
$Revision: 1.21 $
Author:
tripod
See Also:
Serialized Form

Field Summary
static char[] hexDigits
          hexdigits for toString
 
Constructor Summary
UUID()
          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 longs
UUID(String string)
          Generates a UUID from a string. the string must have the form. the version is set accoridingly
UUID(String name, String namespace)
          Create a name base UUID (version 3)
 
Method Summary
static UUID create()
          Generate a UUID for this host using version 1 of [leach]
 boolean equals(Object toUUID)
          Compare two UUIDs
 byte[] getBytes()
          Returns the bytes of the uuid
 int getVersion()
          Get the UUID version number.
 int hashCode()
          Returns a hash code value for the object.
static void init(File uuidStateFile)
          Initialize the UUID generator.
 String 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"
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

hexDigits

public static final char[] hexDigits
hexdigits for toString

Constructor Detail

UUID

public UUID(String string)
Generates a UUID from a string. the string must have the form. the version is set accoridingly. "00000000-0000-0000-0000-000000000000"


UUID

public UUID(byte[] bytes)
Creates a UUID from a byte array.


UUID

public UUID(long[] longs)
Creates a UUID from 2 longs


UUID

public UUID(String name,
            String namespace)
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.

Method Detail

getVersion

public int getVersion()
Get the UUID version number.


equals

public boolean equals(Object toUUID)
Compare two UUIDs

Overrides:
equals in class Object
Returns:
true if the UUIDs are equal; false otherwise.

toString

public String 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"

Overrides:
toString in class Object

getBytes

public byte[] getBytes()
Returns the bytes of the uuid


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 by java.util.Hashtable.

Overrides:
hashCode in class Object
Returns:
a hash code value for this object.
See Also:
Object.equals(java.lang.Object), Hashtable

init

public static void init(File uuidStateFile)
Initialize the UUID generator.

Parameters:
uuidStateFile - the to read/write the state from

create

public static UUID create()
Generate a UUID for this host using version 1 of [leach]



Copyright © 2011-2012 Adobe Systems Incorporated. All Rights Reserved.