info.aduna.text
Class EncodingUtil
java.lang.Object
info.aduna.text.EncodingUtil
public class EncodingUtil
- extends Object
Utility methods for encoding and decoding values in various encoding formats.
|
Method Summary |
static String |
binary2hex(byte[] bytes)
Translates a binary value (in the form of a byte array) to its
hexadecimal value. |
static byte[] |
hex2binary(String hexString)
Translates an hexadecimal value to binary (in the form of a byte array). |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
EncodingUtil
public EncodingUtil()
binary2hex
public static String binary2hex(byte[] bytes)
- Translates a binary value (in the form of a byte array) to its
hexadecimal value. Each byte is translated to a two-digit hexadecimal
value, e.g. the byte value 10 is translated to 0A.
- Parameters:
bytes - The binary value to translate to hexadecimal.
- Returns:
- The hexadecimal value of the binary input.
hex2binary
public static byte[] hex2binary(String hexString)
- Translates an hexadecimal value to binary (in the form of a byte array).
Every two hexadecimal digits are translated to a single byte, e.g. the
hexadecimal value 0A is translated to a single byte with the
value 10.
- Parameters:
hexString - The hexadecimal value to translate to binary.
- Returns:
- The binary value to the hexadecimal input.
- Throws:
NumberFormatException - If the supplied hexString does not represent an
hexadecimal value.
Copyright © 1997-2008 Aduna. All Rights Reserved.