com.realtime.crossfire.jxclient.util
Class HexCodec

java.lang.Object
  extended by com.realtime.crossfire.jxclient.util.HexCodec

public class HexCodec
extends java.lang.Object

Utility class for en-/decoding hexadecimal strings.


Field Summary
private static java.lang.CharSequence HEX_CHARS
          Hex characters for values 0-15.
 
Constructor Summary
private HexCodec()
          Private constructor to prevent instantiation.
 
Method Summary
static java.lang.String hexDump(byte[] data, int start, int end)
          Returns a hex dump of a part of a byte array.
static void hexEncode2(java.lang.StringBuilder sb, int value)
          Append a given value as a two digits hexadecimal number.
private static void hexEncode4(java.lang.StringBuilder sb, int value)
          Append a given value as a four digits hexadecimal number.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HEX_CHARS

@NotNull
private static final java.lang.CharSequence HEX_CHARS
Hex characters for values 0-15.

Constructor Detail

HexCodec

private HexCodec()
Private constructor to prevent instantiation.

Method Detail

hexDump

public static java.lang.String hexDump(@NotNull
                                       byte[] data,
                                       int start,
                                       int end)
Returns a hex dump of a part of a byte array.

Parameters:
data - the byte array to dump
start - the starting index
end - the end index
Returns:
the hex dump

hexEncode2

public static void hexEncode2(@NotNull
                              java.lang.StringBuilder sb,
                              int value)
Append a given value as a two digits hexadecimal number.

Parameters:
sb - the StringBuilder to append to
value - the value to append

hexEncode4

private static void hexEncode4(@NotNull
                               java.lang.StringBuilder sb,
                               int value)
Append a given value as a four digits hexadecimal number.

Parameters:
sb - the StringBuilder to append to
value - the value to append