es.uc3m.it.xbe32.tlv
Class TLV

java.lang.Object
  extended byes.uc3m.it.xbe32.tlv.TLV

public final class TLV
extends Object

This class models the Type-Length-Value (TLV) structures employed by the XBE32 encoding.

From the XBE32 specification ( draft-uruena-xbe32-02.txt ):

    0                   1                   2                   3
    0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |           Type                |            Length             |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   :                                                               :
   :                             Values                            :
   :                                                               :
   :               +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   :               |                  [ Padding ]                  |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   Type (16 bits):

      This field describes the TLV processing rules, structure and which
      kind of data is carried inside the Values field.  The Type field
      has the following internal structure:

       0                   1
       0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
      |C|E|    Meta   |    Subtype    |
      +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+

   C and E bits (1 bit each):

      These two bits specify the actions that must be taken if the
      processing entity does not recognize this Type value:

      C - Continue Processing:
        0 - Discard this mandatory TLV and stop processing TLVs left.
        1 - Skip this optional TLV and continue processing remaining
            TLVs.

      E - Notify Error:
        0 - Do not report to the sender that this Type is unknown.
        1 - Report to the sender that this Type is unknown.

   Meta (6 bits):

      This field describes the internal structure of the TLV's Values
      field, as well as the type of the data it contains.

   Subtype (8 bits):

      This field identifies the meaning of this TLV and/or the data
      carried inside the Values field.  Therefore its values should be
      defined by the upper application/protocol that is employing the
      XBE32 encoding.  Subtype values 0x00 and 0xFF are reserved for
      XBE32 use and MUST NOT be employed for other purposes.

   Length (16 bits):

      This field MUST be encoded as an unsigned binary number in network
      byte order (a.k.a.  Big Endian, i.e, the most significant byte
      first).  It contains the length of the whole TLV structure
      measured in octets, excluding padding.  Length SHOULD be always
      equal or greater than 4 octets, that is, the length of the Type
      and Length values.

   Values and Padding (variable length):

      The Values field contains the actual XBE32-encoded data as
      described by the Type and Length fields.The Values field may be
      empty, that is, have zero length.  In that case the Length field
      MUST be set to 4.  If the Values field contains primitive data
      values, but it cannot be aligned to 4-octet words, padding space
      MUST be added (up to 3 padding octets) and filled with zeros
      (0x00) in transmission, and MUST be ignored in reception.
 

Complex TLVs are TLVs containing other TLVs themselves, whereas Simple TLVs contain zero or more primitive type values. Both, Complex and Simple TLVs can be created with this class.

The Values field of a XBE32 TLV could contain any of these primitive types, according to its Type.Meta part:

Type.Meta Type.Meta value Value type
META_COMPLEX_TLV 0x0000-0x1F00 null
META_OPAQUE_VALUE 0x2000 byte[]
META_STRING_VALUE 0x2100 String
META_OPAQUE1_VALUES 0x2400 byte[]
META_INT8_VALUES 0x2500 byte[]
META_BOOLEAN_VALUES 0x2600 boolean[]
META_OPAQUE2_VALUES 0x2800 byte[2][]
META_INT16_VALUES 0x2900 short[]
META_OPAQUE4_VALUES 0x2C00 byte[4][]
META_INT32_VALUES 0x2D00 int[]
META_FLOAT32_VALUES 0x2E00 float[]
META_OPAQUE8_VALUES 0x3000 byte[8][]
META_INT64_VALUES 0x3100 long[]
META_FLOAT64_VALUES 0x3200 double[]
META_OPAQUE12_VALUES 0x3400 byte[12][]
META_OPAQUE16_VALUES 0x3800 byte[16][]

The Length field is set by the TLVWriter class, to ensure that the generated XBE32-encoded stream has a valid structure.


Field Summary
static int END_OF_TLV_TYPE
          Type of End-of-Data TLV, which marks the end of a Complex TLV with an "unspecified" length.
static int EXTENSIBLE_ATTRIBUTE_ELEMENT_TLV_TYPE
          Type of TLVs containing an Extensible XBE32 Attribute Element (without flags)
static int EXTENSIBLE_BOOLEAN_VALUES_TLV_TYPE
          Type of TLVs containing the Boolean Values of an Extensible Attribute Element
static int EXTENSIBLE_COMPLEX_ELEMENT_TLV_TYPE
          Type of TLVs containing an Extensible XBE32 Complex Element (without flags)
static int EXTENSIBLE_FLOAT32_VALUES_TLV_TYPE
          Type of TLVs containing the Float32 Values of an Extensible Attribute Element
static int EXTENSIBLE_FLOAT64_VALUES_TLV_TYPE
          Type of TLVs containing the Float64 Values of an Extensible Attribute Element
static int EXTENSIBLE_ID_TLV_TYPE
          Type of TLVs containing the identifier of an Extensible XBE32 Element
static int EXTENSIBLE_INT16_VALUES_TLV_TYPE
          Type of TLVs containing the Int16 Values of an Extensible Attribute Element
static int EXTENSIBLE_INT32_VALUES_TLV_TYPE
          Type of TLVs containing the Int32 Values of an Extensible Attribute Element
static int EXTENSIBLE_INT64_VALUES_TLV_TYPE
          Type of TLVs containing the Opaque Value of an Extensible Attribute Element
static int EXTENSIBLE_INT8_VALUES_TLV_TYPE
          Type of TLVs containing the Int8 Values of an Extensible Attribute Element
static int EXTENSIBLE_NAME_TLV_TYPE
          Type of TLVs containing the name of an Extensible XBE32 Element
static int EXTENSIBLE_OPAQUE_VALUE_TLV_TYPE
          Type of TLVs containing the Opaque Value of an Extensible Attribute Element
static int EXTENSIBLE_OPAQUE1_VALUES_TLV_TYPE
          Type of TLVs containing the Opaque1 Values of an Extensible Attribute Element
static int EXTENSIBLE_OPAQUE12_VALUES_TLV_TYPE
          Type of TLVs containing the Opaque12 Values of an Extensible Attribute Element
static int EXTENSIBLE_OPAQUE16_VALUES_TLV_TYPE
          Type of TLVs containing the Opaque16 Values of an Extensible Attribute Element
static int EXTENSIBLE_OPAQUE2_VALUES_TLV_TYPE
          Type of TLVs containing the Opaque2 Values of an Extensible Attribute Element
static int EXTENSIBLE_OPAQUE4_VALUES_TLV_TYPE
          Type of TLVs containing the Opaque4 Values of an Extensible Attribute Element
static int EXTENSIBLE_OPAQUE8_VALUES_TLV_TYPE
          Type of TLVs containing the Opaque8 Values of an Extensible Attribute Element
static int EXTENSIBLE_STRING_VALUE_TLV_TYPE
          Type of TLVs containing the String Value of an Extensible Attribute Element
static int META_BOOLEAN_VALUES
          Meta value of Simple TLVs with multiple Boolean (boolean[]) values
static int META_COMPLEX_TLV_MAX
          Maximum Meta value of Complex TLVs
static int META_COMPLEX_TLV_MIN
          Minimum Meta value of Complex TLVs
static int META_FLOAT32_VALUES
          Meta value of Simple TLVs with multiple Float32 (float[]) values
static int META_FLOAT64_VALUES
          Meta value of Simple TLVs with multiple Float64 (double[]) values
static int META_INT16_VALUES
          Meta value of Simple TLVs with multiple Int16 (short[]) values
static int META_INT32_VALUES
          Meta value of Simple TLVs with multiple Int32 (int[]) values
static int META_INT64_VALUES
          Meta value of Simple TLVs with multiple Int64 (long[]) values
static int META_INT8_VALUES
          Meta value of Simple TLVs with multiple Int8 (byte[]) values
static int META_OPAQUE_VALUE
          Meta value of Simple TLVs with a single variable-length Opaque (byte[]) value
static int META_OPAQUE1_VALUES
          Meta value of Simple TLVs with multiple Opaque1 (byte[]) values
static int META_OPAQUE12_VALUES
          Meta value of Simple TLVs with multiple Opaque12 (byte[12][]) values
static int META_OPAQUE16_VALUES
          Meta value of Simple TLVs with multiple Opaque16 (byte[16][]) values
static int META_OPAQUE2_VALUES
          Meta value of Simple TLVs with multiple Opaque2 (byte[2][]) values
static int META_OPAQUE4_VALUES
          Meta value of Simple TLVs with multiple Opaque4 (byte[4][]) values
static int META_OPAQUE8_VALUES
          Meta value of Simple TLVs with multiple Opaque8 (byte[8][]) values
static int META_STRING_VALUE
          Meta value of Simple TLVs with a single variable-length String value
 
Constructor Summary
TLV(int type)
          Creates a Complex TLV with the specified Type field.
TLV(int type, Object values)
          Creates a Simple TLV with the specified Type and Values fields.
 
Method Summary
 boolean getContinueFlag()
          Returns the Continue flag of this TLV.
static boolean getContinueFlag(int type)
          Returns whether the Continue flag of the specified TLV Type is set or not.
 boolean getErrorFlag()
          Returns the Error flag of this TLV.
static boolean getErrorFlag(int type)
          Returns whether the Error flag of the specified TLV Type is set or not.
 int getLength()
          Returns the Length field of this TLV (without padding).
 int getMeta()
          Returns the Meta part of this TLV.
static int getMeta(int type)
          Returns the Meta part of the specified TLV Type.
 int getPaddedLength()
          Returns the total length of this TLV (with padding).
 int getPadding()
          Returns the number of padding zeros required to align this TLV to 4-octets words.
static int getPadding(int length)
          Returns the number of padding zeros required to align the TLV to 4-octets words.
 int getSubtype()
          Returns the Subtype part of this TLV.
static int getSubtype(int type)
          Returns the Subtype part of the specified TLV Type.
 int getType()
          Returns the Type field of this TLV.
 Object getValues()
          Returns the Values field of this TLV.
 boolean isComplex()
          Returns whether this TLV is a Complex or a Simple one.
static boolean isComplex(int type)
          Returns whether the specified Type belongs to a Complex TLV.
static String toHex(byte b)
          Returns a String with the hexadecimal value of the byte parameter.
static String toHex(byte[] a)
          Returns a String with the hexadecimal value of the byte array parameter.
static String toHex(int i)
          Returns a String with the hexadecimal value of the integer parameter.
static String toHex(long l)
          Returns a String with the hexadecimal value of the long parameter.
static String toHex(short s)
          Returns a String with the hexadecimal value of the short parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

META_COMPLEX_TLV_MIN

public static final int META_COMPLEX_TLV_MIN
Minimum Meta value of Complex TLVs

See Also:
Constant Field Values

META_COMPLEX_TLV_MAX

public static final int META_COMPLEX_TLV_MAX
Maximum Meta value of Complex TLVs

See Also:
Constant Field Values

META_OPAQUE_VALUE

public static final int META_OPAQUE_VALUE
Meta value of Simple TLVs with a single variable-length Opaque (byte[]) value

See Also:
Constant Field Values

META_STRING_VALUE

public static final int META_STRING_VALUE
Meta value of Simple TLVs with a single variable-length String value

See Also:
Constant Field Values

META_OPAQUE1_VALUES

public static final int META_OPAQUE1_VALUES
Meta value of Simple TLVs with multiple Opaque1 (byte[]) values

See Also:
Constant Field Values

META_INT8_VALUES

public static final int META_INT8_VALUES
Meta value of Simple TLVs with multiple Int8 (byte[]) values

See Also:
Constant Field Values

META_BOOLEAN_VALUES

public static final int META_BOOLEAN_VALUES
Meta value of Simple TLVs with multiple Boolean (boolean[]) values

See Also:
Constant Field Values

META_OPAQUE2_VALUES

public static final int META_OPAQUE2_VALUES
Meta value of Simple TLVs with multiple Opaque2 (byte[2][]) values

See Also:
Constant Field Values

META_INT16_VALUES

public static final int META_INT16_VALUES
Meta value of Simple TLVs with multiple Int16 (short[]) values

See Also:
Constant Field Values

META_OPAQUE4_VALUES

public static final int META_OPAQUE4_VALUES
Meta value of Simple TLVs with multiple Opaque4 (byte[4][]) values

See Also:
Constant Field Values

META_INT32_VALUES

public static final int META_INT32_VALUES
Meta value of Simple TLVs with multiple Int32 (int[]) values

See Also:
Constant Field Values

META_FLOAT32_VALUES

public static final int META_FLOAT32_VALUES
Meta value of Simple TLVs with multiple Float32 (float[]) values

See Also:
Constant Field Values

META_OPAQUE8_VALUES

public static final int META_OPAQUE8_VALUES
Meta value of Simple TLVs with multiple Opaque8 (byte[8][]) values

See Also:
Constant Field Values

META_INT64_VALUES

public static final int META_INT64_VALUES
Meta value of Simple TLVs with multiple Int64 (long[]) values

See Also:
Constant Field Values

META_FLOAT64_VALUES

public static final int META_FLOAT64_VALUES
Meta value of Simple TLVs with multiple Float64 (double[]) values

See Also:
Constant Field Values

META_OPAQUE12_VALUES

public static final int META_OPAQUE12_VALUES
Meta value of Simple TLVs with multiple Opaque12 (byte[12][]) values

See Also:
Constant Field Values

META_OPAQUE16_VALUES

public static final int META_OPAQUE16_VALUES
Meta value of Simple TLVs with multiple Opaque16 (byte[16][]) values

See Also:
Constant Field Values

END_OF_TLV_TYPE

public static final int END_OF_TLV_TYPE
Type of End-of-Data TLV, which marks the end of a Complex TLV with an "unspecified" length.

See Also:
Constant Field Values

EXTENSIBLE_COMPLEX_ELEMENT_TLV_TYPE

public static final int EXTENSIBLE_COMPLEX_ELEMENT_TLV_TYPE
Type of TLVs containing an Extensible XBE32 Complex Element (without flags)

See Also:
Constant Field Values

EXTENSIBLE_ATTRIBUTE_ELEMENT_TLV_TYPE

public static final int EXTENSIBLE_ATTRIBUTE_ELEMENT_TLV_TYPE
Type of TLVs containing an Extensible XBE32 Attribute Element (without flags)

See Also:
Constant Field Values

EXTENSIBLE_NAME_TLV_TYPE

public static final int EXTENSIBLE_NAME_TLV_TYPE
Type of TLVs containing the name of an Extensible XBE32 Element

See Also:
Constant Field Values

EXTENSIBLE_ID_TLV_TYPE

public static final int EXTENSIBLE_ID_TLV_TYPE
Type of TLVs containing the identifier of an Extensible XBE32 Element

See Also:
Constant Field Values

EXTENSIBLE_OPAQUE_VALUE_TLV_TYPE

public static final int EXTENSIBLE_OPAQUE_VALUE_TLV_TYPE
Type of TLVs containing the Opaque Value of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_STRING_VALUE_TLV_TYPE

public static final int EXTENSIBLE_STRING_VALUE_TLV_TYPE
Type of TLVs containing the String Value of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_OPAQUE1_VALUES_TLV_TYPE

public static final int EXTENSIBLE_OPAQUE1_VALUES_TLV_TYPE
Type of TLVs containing the Opaque1 Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_INT8_VALUES_TLV_TYPE

public static final int EXTENSIBLE_INT8_VALUES_TLV_TYPE
Type of TLVs containing the Int8 Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_BOOLEAN_VALUES_TLV_TYPE

public static final int EXTENSIBLE_BOOLEAN_VALUES_TLV_TYPE
Type of TLVs containing the Boolean Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_OPAQUE2_VALUES_TLV_TYPE

public static final int EXTENSIBLE_OPAQUE2_VALUES_TLV_TYPE
Type of TLVs containing the Opaque2 Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_INT16_VALUES_TLV_TYPE

public static final int EXTENSIBLE_INT16_VALUES_TLV_TYPE
Type of TLVs containing the Int16 Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_OPAQUE4_VALUES_TLV_TYPE

public static final int EXTENSIBLE_OPAQUE4_VALUES_TLV_TYPE
Type of TLVs containing the Opaque4 Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_INT32_VALUES_TLV_TYPE

public static final int EXTENSIBLE_INT32_VALUES_TLV_TYPE
Type of TLVs containing the Int32 Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_FLOAT32_VALUES_TLV_TYPE

public static final int EXTENSIBLE_FLOAT32_VALUES_TLV_TYPE
Type of TLVs containing the Float32 Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_OPAQUE8_VALUES_TLV_TYPE

public static final int EXTENSIBLE_OPAQUE8_VALUES_TLV_TYPE
Type of TLVs containing the Opaque8 Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_INT64_VALUES_TLV_TYPE

public static final int EXTENSIBLE_INT64_VALUES_TLV_TYPE
Type of TLVs containing the Opaque Value of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_FLOAT64_VALUES_TLV_TYPE

public static final int EXTENSIBLE_FLOAT64_VALUES_TLV_TYPE
Type of TLVs containing the Float64 Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_OPAQUE12_VALUES_TLV_TYPE

public static final int EXTENSIBLE_OPAQUE12_VALUES_TLV_TYPE
Type of TLVs containing the Opaque12 Values of an Extensible Attribute Element

See Also:
Constant Field Values

EXTENSIBLE_OPAQUE16_VALUES_TLV_TYPE

public static final int EXTENSIBLE_OPAQUE16_VALUES_TLV_TYPE
Type of TLVs containing the Opaque16 Values of an Extensible Attribute Element

See Also:
Constant Field Values
Constructor Detail

TLV

public TLV(int type)
    throws IllegalArgumentException
Creates a Complex TLV with the specified Type field.
The Length field is initially set to zero.

Parameters:
type - the Complex TLV Type field
Throws:
IllegalArgumentException - if the speficied Type value is not a Complex one

TLV

public TLV(int type,
           Object values)
    throws IllegalArgumentException
Creates a Simple TLV with the specified Type and Values fields.
The TLV Length is filled automatically.

Parameters:
type - the Simple TLV Type field
values - the Simple TLV Values field
Throws:
IllegalArgumentException - If the specified Type value is not a Simple one, it does not match with the specified Values, or the Values have incorrect lengths
Method Detail

getType

public int getType()
Returns the Type field of this TLV.

Returns:
The TLV Type field value

getContinueFlag

public static boolean getContinueFlag(int type)
Returns whether the Continue flag of the specified TLV Type is set or not.

Parameters:
type - the TLV Type to be queried
Returns:
true if the Continue flag is set or false when it is not

getContinueFlag

public boolean getContinueFlag()
Returns the Continue flag of this TLV.

Returns:
true if the Continue flag of this TLV is set or false when it is not

getErrorFlag

public static boolean getErrorFlag(int type)
Returns whether the Error flag of the specified TLV Type is set or not.

Parameters:
type - the TLV Type to be queried
Returns:
true if the Error flag is set or false when it is not

getErrorFlag

public boolean getErrorFlag()
Returns the Error flag of this TLV.

Returns:
true if the Error flag of this TLV is set or false when it is not

getMeta

public static int getMeta(int type)
Returns the Meta part of the specified TLV Type.

Parameters:
type - the TLV Type to be queried
Returns:
Type's Meta part with the C and E flags set to zero
See Also:
META_COMPLEX_TLV_MIN, META_COMPLEX_TLV_MAX, META_OPAQUE_VALUE, META_STRING_VALUE, META_OPAQUE1_VALUES, META_INT8_VALUES, META_BOOLEAN_VALUES, META_OPAQUE2_VALUES, META_INT16_VALUES, META_OPAQUE4_VALUES, META_INT32_VALUES, META_FLOAT32_VALUES, META_OPAQUE8_VALUES, META_INT64_VALUES, META_FLOAT64_VALUES, META_OPAQUE12_VALUES, META_OPAQUE16_VALUES

getMeta

public int getMeta()
Returns the Meta part of this TLV.

Returns:
Type's Meta part with the C and E flags set to zero
See Also:
META_COMPLEX_TLV_MIN, META_COMPLEX_TLV_MAX, META_OPAQUE_VALUE, META_STRING_VALUE, META_OPAQUE1_VALUES, META_INT8_VALUES, META_BOOLEAN_VALUES, META_OPAQUE2_VALUES, META_INT16_VALUES, META_OPAQUE4_VALUES, META_INT32_VALUES, META_FLOAT32_VALUES, META_OPAQUE8_VALUES, META_INT64_VALUES, META_FLOAT64_VALUES, META_OPAQUE12_VALUES, META_OPAQUE16_VALUES

isComplex

public static boolean isComplex(int type)
Returns whether the specified Type belongs to a Complex TLV.

Parameters:
type - the TLV Type to be queried
Returns:
true if the TLV Type is a Complex one or false if it is a Simple one.

isComplex

public boolean isComplex()
Returns whether this TLV is a Complex or a Simple one.

Returns:
true if this TLV is a Complex one or false if it is a Simple one

getSubtype

public static int getSubtype(int type)
Returns the Subtype part of the specified TLV Type.

Parameters:
type - the TLV Type to be queried
Returns:
Type's Subtype part

getSubtype

public int getSubtype()
Returns the Subtype part of this TLV.

Returns:
Type's Subtype part

getLength

public int getLength()
Returns the Length field of this TLV (without padding). Complex TLVs may return a zero length.

Returns:
The TLV Length field value
See Also:
getPaddedLength()

getPadding

public static int getPadding(int length)
Returns the number of padding zeros required to align the TLV to 4-octets words.

Parameters:
length - the Length of the TLV to be aligned
Returns:
The number of padding bytes required for 32-bit alignment

getPadding

public int getPadding()
Returns the number of padding zeros required to align this TLV to 4-octets words.

Returns:
The number of padding bytes required for 32-bit alignment

getPaddedLength

public int getPaddedLength()
Returns the total length of this TLV (with padding). Complex TLVs may return a zero length.

Returns:
The total TLV length (aligned to 4-octets words)

getValues

public Object getValues()
Returns the Values field of this TLV. Complex TLVs return a null value.

Returns:
The TLV Values field

toHex

public static String toHex(byte b)
Returns a String with the hexadecimal value of the byte parameter.

Parameters:
b - the byte value to be represented in hexadecimal.
Returns:
the hexadecimal String representation, 2 uppercase chars long.

toHex

public static String toHex(short s)
Returns a String with the hexadecimal value of the short parameter.

Parameters:
s - the short value to be represented in hexadecimal
Returns:
the hexadecimal String representation, 4 uppercase chars long.

toHex

public static String toHex(int i)
Returns a String with the hexadecimal value of the integer parameter.

Parameters:
i - the int value to be represented in hexadecimal
Returns:
the hexadecimal String representation, 8 uppercase chars long.

toHex

public static String toHex(long l)
Returns a String with the hexadecimal value of the long parameter.

Parameters:
l - the long value to be represented in hexadecimal
Returns:
the hexadecimal String representation, 16 uppercase chars long.

toHex

public static String toHex(byte[] a)
Returns a String with the hexadecimal value of the byte array parameter.

Parameters:
a - the byte array to be represented in hexadecimal
Returns:
the hexadecimal String representation, 2 uppercase chars long per array position.