codec
Class Hex

java.lang.Object
  |
  +--codec.Hex

public final class Hex
extends Object

A converter that converts binary data into strings of hexadecimal characters and vice versa.

Version:
"$Id: Hex.java,v 1.2 2005/04/06 09:31:01 flautens Exp $"
Author:
Volker Roth

Method Summary
static byte[] decode(String in)
          Decodes a hexadecimal encoded string into an array of bytes with exactly the length of the encoded data.
static String encode(byte[] in)
          Encodes the input array of bytes into a hexadecimal 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 String encode(byte[] in)
Encodes the input array of bytes into a hexadecimal encoded string.
Parameters:
in - The byte array to be encoded.
Returns:
The hexadecimal encoded String representing the input byte array.

decode

public static byte[] decode(String in)
                     throws CorruptedCodeException
Decodes a hexadecimal encoded string into an array of bytes with exactly the length of the encoded data.
Parameters:
in - The encoded hexadecimal character String.
Returns:
The decoded data.
Throws:
CorruptedCodeException - if the hexadecimal code contains errors such as a missing character.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.