net.freeutils.tnef

Class GUID

public class GUID extends Object

The GUID class encapsulates a GUID (Globally Unique IDentifier). GUID instances are immutable.

Since: 2007-07-19

Constructor Summary
GUID(String guid)
Constructs a GUID with the specified value.
GUID(byte[] guid)
Constructs a GUID with the specified value.
Method Summary
static Stringcanonize(String guid)
Canonizes the given GUID string into the canonical format of the form: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", with all values presented as lowercase hex digits.
booleanequals(Object o)
Returns whether this GUID is identical to the given GUID.
inthashCode()
Returns a hash code value for the object.
byte[]toByteArray()
Returns the GUID as a 16-byte array.
StringtoString()
Returns a string representation of this object.

Constructor Detail

GUID

public GUID(String guid)
Constructs a GUID with the specified value.

Parameters: guid the GUID value as a hex string (with optional canonical dashes)

Throws: IllegalArgumentException if the given string does not contain a valid GUID

GUID

public GUID(byte[] guid)
Constructs a GUID with the specified value.

Parameters: guid the GUID value

Throws: IllegalArgumentException if the given array does not contain a valid GUID

Method Detail

canonize

public static String canonize(String guid)
Canonizes the given GUID string into the canonical format of the form: "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee", with all values presented as lowercase hex digits. Valid GUIDs consist of 32 case insensitive hex digits (representing 16 bytes), with or without the separating dashes in the appropriate positions.

Parameters: guid the GUID value

Returns: the canonized GUID string

Throws: IllegalArgumentException if the given string does not contain a valid GUID

equals

public boolean equals(Object o)
Returns whether this GUID is identical to the given GUID.

Returns: true if this object is the same as the obj argument; false otherwise

hashCode

public int hashCode()
Returns a hash code value for the object.

Returns: a hash code value for this object

toByteArray

public byte[] toByteArray()
Returns the GUID as a 16-byte array.

Returns: the GUID as a 16-byte array

toString

public String toString()
Returns a string representation of this object.

Returns: a string representation of this object