org.jboss.wsf.common.utils
Class UUIDGenerator

java.lang.Object
  extended by org.jboss.wsf.common.utils.UUIDGenerator

public class UUIDGenerator
extends java.lang.Object

Generates the string form of IETF variant UUIDs. See the latest IETF draft for more information about UUID generation. Currently only pseudo random (type 4) UUIDs are supported.

Author:
Jason T. Greene

Constructor Summary
UUIDGenerator()
           
 
Method Summary
static java.lang.String convertToString(byte[] uuid)
          Converts a UUID in byte array form to the IETF string format.
static byte[] generateRandomUUIDBytes()
          Generates a pseudo random UUID and returns it in byte array form.
static java.lang.String generateRandomUUIDString()
          Generates a pseudo random UUID and returns it the IETF specified String form.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

UUIDGenerator

public UUIDGenerator()
Method Detail

generateRandomUUIDBytes

public static byte[] generateRandomUUIDBytes()
Generates a pseudo random UUID and returns it in byte array form.

Returns:
a UUID byte array in network order

generateRandomUUIDString

public static java.lang.String generateRandomUUIDString()
Generates a pseudo random UUID and returns it the IETF specified String form. See convertToString(byte[]) for a description of the format.

Returns:
a UUID in IETF string form.

convertToString

public static java.lang.String convertToString(byte[] uuid)
Converts a UUID in byte array form to the IETF string format.

The BNF follows:

  UUID                   =  "-"  "-"
                            "-"
                            "-"
                           
  time_low               = 4*
  time_mid               = 2*
  time_high_and_version  = 2*
  variant_and_sequence   = 2*
  node                   = 6*
  hexOctet               = 
  hexDigit               =
        "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"
        | "a" | "b" | "c" | "d" | "e" | "f"
        | "A" | "B" | "C" | "D" | "E" | "F"
 

Parameters:
uuid - a 16 byte
Returns:
the IETF string form of the passed UUID


Copyright © 2009 JBoss, a division of Red Hat. All Rights Reserved.