flex.messaging.util
Class UUIDUtils

java.lang.Object
  extended by flex.messaging.util.UUIDUtils

public class UUIDUtils
extends Object

Static class that creates GUIDs according to the principles laid out in UUIDs and GUIDs. Specifically, these GUIDs have elements specific to the time and place of their creation; a unique TOD value (but the low-level IEEE 802/MAC address of the host system is not determined). The rest of the GUID is a sequence of random hex digits from a cryptographically strong random number generator.

This class differs from the Leach specification in a few ways. It does not use a persistent store to track the clock sequence and does not coordinate ids given out by 2 processes on the same machine. It does not follow the formal clock sequence guidelines but instead uses random numbers for all but the timestamp.


Method Summary
static String createUUID()
          Use the createUUID function when you need a unique string that you will use as a persistent identifier in a distributed environment.
static String createUUID(boolean secure)
           
static String fromByteArray(byte[] ba)
          Converts a 128-bit UID encoded as a byte[] to a String representation.
static boolean isUID(String uid)
          A utility method to check whether a String value represents a correctly formatted UID value.
static byte[] toByteArray(String uid)
          Converts a UID formatted String to a byte[].
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createUUID

public static String createUUID()
Use the createUUID function when you need a unique string that you will use as a persistent identifier in a distributed environment. To a very high degree of certainty, this function returns a unique value; no other invocation on the same or any other system should return the same value.

Returns:
a Universally Unique Identifier (UUID) Proper Format: `XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX' where `X' stands for a hexadecimal digit (0-9 or A-F).

createUUID

public static String createUUID(boolean secure)
Parameters:
secure - Boolean indicating whether to create a secure UUID.
See Also:
UUIDUtils.createUUID()

fromByteArray

public static String fromByteArray(byte[] ba)
Converts a 128-bit UID encoded as a byte[] to a String representation. The format matches that generated by createUID. If a suitable byte[] is not provided, null is returned.

Parameters:
ba - byte[] 16 bytes in length representing a 128-bit UID.
Returns:
String representation of the UID, or null if an invalid byte[] is provided.

isUID

public static boolean isUID(String uid)
A utility method to check whether a String value represents a correctly formatted UID value. UID values are expected to be in the format generated by createUID(), implying that only capitalized A-F characters in addition to 0-9 digits are supported.

Parameters:
uid - The value to test whether it is formatted as a UID.
Returns:
Returns true if the value is formatted as a UID.

toByteArray

public static byte[] toByteArray(String uid)
Converts a UID formatted String to a byte[]. The UID must be in the format generated by createUID, otherwise null is returned.

Parameters:
uid - String representing a 128-bit UID.
Returns:
byte[] 16 bytes in length representing the 128-bits of the UID or null if the uid could not be converted.


Copyright © 2008 Adobe Systems Inc. All Rights Reserved.

 

Send me an e-mail when comments are added to this page | Comment Report

Current page: http://livedocs.adobe.com/blazeds/1/javadoc/flex/messaging/util/UUIDUtils.html