intarsys runtime library

de.intarsys.tools.hex
Class HexTools

java.lang.Object
  extended by de.intarsys.tools.hex.HexTools

public class HexTools
extends Object

Helper class for faster mapping of bytes to their hex equivalent


Field Summary
static byte[][] ByteToHex
          ASCII byte values for the hex strings.
static byte[][] byteToHexLower
          ASCII byte values for the hex strings.
 
Constructor Summary
HexTools()
           
 
Method Summary
static String bytesToHexString(byte[] data)
           
static String bytesToHexString(byte[] data, int offset, int length)
           
static String bytesToHexString(byte[] data, int offset, int length, boolean space)
           
static int hexDigitToInt(char c)
          The numeric value for the hex digit, return -1 if not valid digit
static byte[] hexStringToBytes(String hexString)
           
static int hexStringToInt(String hexString)
           
static boolean isHexDigit(char i)
          Evaluate to true if i is a valid hex digit
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ByteToHex

public static final byte[][] ByteToHex
ASCII byte values for the hex strings.


byteToHexLower

public static final byte[][] byteToHexLower
ASCII byte values for the hex strings.

Constructor Detail

HexTools

public HexTools()
Method Detail

bytesToHexString

public static String bytesToHexString(byte[] data)

bytesToHexString

public static String bytesToHexString(byte[] data,
                                      int offset,
                                      int length)

bytesToHexString

public static String bytesToHexString(byte[] data,
                                      int offset,
                                      int length,
                                      boolean space)

hexDigitToInt

public static int hexDigitToInt(char c)
The numeric value for the hex digit, return -1 if not valid digit

Parameters:
i - A char representing a hex digit.
Returns:
The numeric value of the hex digit

hexStringToBytes

public static byte[] hexStringToBytes(String hexString)

hexStringToInt

public static int hexStringToInt(String hexString)

isHexDigit

public static boolean isHexDigit(char i)
Evaluate to true if i is a valid hex digit

Parameters:
i - A char representing a hex digit.
Returns:
true if i is a valid hex digit.

intarsys runtime library

Copyright © 2008 intarsys consulting GmbH. All Rights Reserved.