org.ldaptive.io
Class Hex

java.lang.Object
  extended by org.ldaptive.io.Hex

public final class Hex
extends Object

Utility for hexidecimal encoding and decoding.

Version:
$Revision: 2885 $ $Date: 2014-02-05 16:28:49 -0500 (Wed, 05 Feb 2014) $
Author:
Middleware Services

Method Summary
static byte[] decode(char[] value)
          This will convert the supplied value to a hex encoded string.
protected static int decode(char[] hex, int i)
          Decodes the supplied character to it's corresponding nibble.
static char[] encode(byte[] value)
          This will convert the supplied value to a hex encoded string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static char[] encode(byte[] value)
This will convert the supplied value to a hex encoded string. Returns null if the supplied value is null.

Parameters:
value - to hex encode
Returns:
hex encoded value

decode

public static byte[] decode(char[] value)
This will convert the supplied value to a hex encoded string. Returns null if the supplied value is null.

Parameters:
value - to hex encode
Returns:
hex encoded value
Throws:
IllegalArgumentException - if value is not valid hexidecimal

decode

protected static int decode(char[] hex,
                            int i)
Decodes the supplied character to it's corresponding nibble.

Parameters:
hex - to read character from
i - index of hex to read
Returns:
0-15 integer
Throws:
IllegalArgumentException - if the character is not valid hex


Copyright © 2003-2017 Virginia Tech. All Rights Reserved.