Tools
Class HexDumper

java.lang.Object
  extended by Tools.HexDumper

public class HexDumper
extends java.lang.Object

Simple byte array to hex conversion class


Field Summary
private  byte[] bytes
          Byte array to work with
 
Constructor Summary
HexDumper(byte[] bytes)
          Generate a new HexDumper
HexDumper(java.lang.String str)
          Generate a new HexDumper
 
Method Summary
static java.lang.String byteToHex(byte beit)
          Convert one byte to hexadecimal
static byte cleanByte(byte b)
          Filter escape characters
 java.lang.String convert()
          Convert to a string of hexadecimal numbers
static char intToHex(int hbyte)
          Convert one integer to hexadecimal
static java.lang.String lineNumber(int i, int w)
          Pretty line number
static void main(java.lang.String[] args)
           
 java.lang.String toString()
          Get a string representation of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

bytes

private byte[] bytes
Byte array to work with

Constructor Detail

HexDumper

public HexDumper(byte[] bytes)
Generate a new HexDumper

Parameters:
bytes - Byte array to work with

HexDumper

public HexDumper(java.lang.String str)
Generate a new HexDumper

Parameters:
str - String to work with
Method Detail

toString

public java.lang.String toString()
Get a string representation of this object

Overrides:
toString in class java.lang.Object
Returns:
String

convert

public java.lang.String convert()
Convert to a string of hexadecimal numbers

Returns:
String

cleanByte

public static byte cleanByte(byte b)
Filter escape characters

Parameters:
b - A byte
Returns:
Filtered byte

lineNumber

public static java.lang.String lineNumber(int i,
                                          int w)
Pretty line number

Parameters:
i - Line number
w - Width of the line number column
Returns:
Correctly aligned line number in a string

byteToHex

public static java.lang.String byteToHex(byte beit)
Convert one byte to hexadecimal

Parameters:
beit - A byte
Returns:
Hexadecimal string

intToHex

public static char intToHex(int hbyte)
Convert one integer to hexadecimal

Parameters:
hbyte - An integer
Returns:
Hexadecimal string

main

public static void main(java.lang.String[] args)