com.vgrs.xcode.common
Class Hex

java.lang.Object
  extended by com.vgrs.xcode.common.Hex

public final class Hex
extends java.lang.Object

Base 16 or Hexadecimal is often represented using the digits 0-9 as well as the letters a-f. The decode methods in this class interpret this Hexadecimal notation, converting into usable data structures. The encode methods perform the opposite function, representing internal data using Hexadecimal notation.


Constructor Summary
Hex()
           
 
Method Summary
static byte[] decodeBytes(java.lang.String aInput)
          Return the data structure represented by the Hexadecimal input sequence.
static char[] decodeChars(java.lang.String aInput)
          Return the data structure represented by the Hexadecimal input sequence.
static int[] decodeInts(java.lang.String aInput)
          Return the data structure represented by the Hexadecimal input sequence.
static java.lang.String encode(byte[] aInput)
          Return the Hexadecimal representation of the input sequence.
static java.lang.String encode(char[] aInput)
          Return the Hexadecimal representation of the input sequence.
static java.lang.String encode(int[] aInput)
          Return the Hexadecimal representation of the input sequence.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hex

public Hex()
Method Detail

encode

public static java.lang.String encode(byte[] aInput)
                               throws XcodeException
Return the Hexadecimal representation of the input sequence.

Parameters:
aInput - Sequence of 8 bit bytes
Returns:
Sets of two characters separated by a space. Each group represents a single byte from the input stream using hex notation.
Throws:
XcodeException - if the input is null or with length == 0

encode

public static java.lang.String encode(char[] aInput)
                               throws XcodeException
Return the Hexadecimal representation of the input sequence.

Parameters:
aInput - Sequence of 16 bit characters in UTF16 format
Returns:
Sets of four characters separated by a space. Each group represents a single character from the input stream using hex notation.
Throws:
XcodeException - if the input is null or with length == 0

encode

public static java.lang.String encode(int[] aInput)
                               throws XcodeException
Return the Hexadecimal representation of the input sequence.

Parameters:
aInput - Sequence of integers representing Unicode characters.
Returns:
Grouped characters separated by a space. Each group represents a single Unicode character from the input stream using hex notation.
Throws:
XcodeException - if the input is null or with length == 0

decodeBytes

public static byte[] decodeBytes(java.lang.String aInput)
                          throws XcodeException
Return the data structure represented by the Hexadecimal input sequence.

Parameters:
aInput - Grouped characters separated by a space. Each group represents a single byte using hex notation.
Returns:
Each group of bytes in hex notation is interpreted to create a new 8 bit Java byte primitive.
Throws:
XcodeException - if the input is null or with length == 0 or if length of the input indicates the hex value is greater than 0xff

decodeChars

public static char[] decodeChars(java.lang.String aInput)
                          throws XcodeException
Return the data structure represented by the Hexadecimal input sequence.

Parameters:
aInput - Grouped characters separated by a space. Each group represents a single Utf16 character using hex notation.
Returns:
Each group of characters in hex notation is interpreted to create a new 16 bit Java character primitive.
Throws:
XcodeException - if the input is null or with length == 0 or if length of the input indicates the hex value is greater than 0xff

decodeInts

public static int[] decodeInts(java.lang.String aInput)
                        throws XcodeException
Return the data structure represented by the Hexadecimal input sequence.

Parameters:
aInput - Grouped characters separated by a space. Each group represents a single Unicode character using hex notation.
Returns:
Each group of characters in hex notation is interpreted as a Unicode value resulting in a 21 bit Java int primitive.
Throws:
XcodeException - if the input is null or with length == 0 or if length of the input indicates the hex value is greater than 0xffffffff


Copyright © 2000-2010 VeriSign Inc. All Rights Reserved