org.apache.xml.security.utils
Class HexDump

java.lang.Object
  |
  +--org.apache.xml.security.utils.HexDump

public class HexDump
extends java.lang.Object

Author:
Niko Schweitzer

Method Summary
static java.lang.String byteArrayToBinaryString(byte[] block)
          Description of the Method
static java.lang.String byteArrayToHexString(byte[] block)
          Description of the Method
static java.lang.String byteArrayToHexString(byte[] block, int offset, int length)
          Description of the Method
static byte[] hexStringToByteArray(java.lang.String strA)
          Converts readable hex-String to byteArray
static void main(java.lang.String[] args)
          test and demo for the Convert class
static java.lang.String prettyPrintHex(byte[] baToConvert)
          Method prettyPrintHex
static java.lang.String prettyPrintHex(java.lang.String sToConvert)
          Method prettyPrintHex
static void setBitDigits(char[] bd)
          Sets the BitDigits attribute of the Convert class
static void setBitDigits(char zeroBit, char oneBit)
          Method setBitDigits
static void setByteSeparator(char bs)
          Sets the ByteSeparator attribute of the Convert class
static void setDebug(boolean dbg)
          Sets the Debug attribute of the Convert object
static void setWithByteSeparator(boolean bs)
          Sets the WithByteSeparator attribute of the Convert class
static java.lang.String stringToHexString(java.lang.String in)
          Description of the Method
static java.lang.String toBinaryString(byte b)
          Method toBinaryString
static java.lang.String toBinaryString(byte[] ba)
          Method toBinaryString
static java.lang.String toBinaryString(int i)
          Method toBinaryString
static java.lang.String toBinaryString(long l)
          Method toBinaryString
static java.lang.String toBinaryString(short s)
          Method toBinaryString
static byte[] toByteArray(int i)
          Method toByteArray
static byte[] toByteArray(long l)
          Method toByteArray
static byte[] toByteArray(short s)
          Method toByteArray
static java.lang.String toHexString(byte b)
          Method toHexString
static java.lang.String toHexString(byte[] ba)
          Returns a string of hexadecimal digits from a byte array.
static java.lang.String toHexString(byte[] ba, int offset, int length)
          converts String to Hex String.
static java.lang.String toHexString(int i)
          Method toHexString
static java.lang.String toHexString(long l)
          Method toHexString
static java.lang.String toHexString(short s)
          Description of the Method
static java.lang.String toString(byte b)
          Method toString
static java.lang.String toString(byte[] ba)
          Method toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

prettyPrintHex

public static java.lang.String prettyPrintHex(byte[] baToConvert)
Method prettyPrintHex

Parameters:
baToConvert -
Returns:
hexdump string

prettyPrintHex

public static java.lang.String prettyPrintHex(java.lang.String sToConvert)
Method prettyPrintHex

Parameters:
sToConvert -
Returns:
hexdump string

setDebug

public static void setDebug(boolean dbg)
Sets the Debug attribute of the Convert object

Parameters:
dbg - The new Debug value

setWithByteSeparator

public static void setWithByteSeparator(boolean bs)
Sets the WithByteSeparator attribute of the Convert class

Parameters:
bs - The new WithByteSeparator value

setByteSeparator

public static void setByteSeparator(char bs)
Sets the ByteSeparator attribute of the Convert class

Parameters:
bs - The new ByteSeparator value

setBitDigits

public static void setBitDigits(char[] bd)
                         throws java.lang.Exception
Sets the BitDigits attribute of the Convert class

Parameters:
bd - The new BitDigits value
Throws:
java.lang.Exception - Description of Exception

setBitDigits

public static void setBitDigits(char zeroBit,
                                char oneBit)
Method setBitDigits

Parameters:
zeroBit -
oneBit -

byteArrayToBinaryString

public static java.lang.String byteArrayToBinaryString(byte[] block)
Description of the Method

Parameters:
block - Description of Parameter
Returns:
Description of the Returned Value

toBinaryString

public static java.lang.String toBinaryString(byte[] ba)
Method toBinaryString

Parameters:
ba -

toBinaryString

public static java.lang.String toBinaryString(byte b)
Method toBinaryString

Parameters:
b -

toBinaryString

public static java.lang.String toBinaryString(short s)
Method toBinaryString

Parameters:
s -

toBinaryString

public static java.lang.String toBinaryString(int i)
Method toBinaryString

Parameters:
i -

toBinaryString

public static java.lang.String toBinaryString(long l)
Method toBinaryString

Parameters:
l -

toByteArray

public static final byte[] toByteArray(short s)
Method toByteArray

Parameters:
s -

toByteArray

public static final byte[] toByteArray(int i)
Method toByteArray

Parameters:
i -

toByteArray

public static final byte[] toByteArray(long l)
Method toByteArray

Parameters:
l -

byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] block)
Description of the Method

Parameters:
block - Description of Parameter
Returns:
Description of the Returned Value

stringToHexString

public static java.lang.String stringToHexString(java.lang.String in)
Description of the Method

Parameters:
in - string to be converted
Returns:
String in readable hex encoding

byteArrayToHexString

public static java.lang.String byteArrayToHexString(byte[] block,
                                                    int offset,
                                                    int length)
Description of the Method

Parameters:
block - Description of Parameter
offset - Description of Parameter
length - Description of Parameter
Returns:
Description of the Returned Value

toHexString

public static java.lang.String toHexString(byte[] ba)
Returns a string of hexadecimal digits from a byte array. Each byte is converted to 2 hex symbols.

Parameters:
ba - Description of Parameter
Returns:
Description of the Returned Value

toHexString

public static java.lang.String toHexString(byte b)
Method toHexString

Parameters:
b -

toHexString

public static java.lang.String toHexString(short s)
Description of the Method

Parameters:
s -
Returns:
Description of the Returned Value

toHexString

public static java.lang.String toHexString(int i)
Method toHexString

Parameters:
i -

toHexString

public static java.lang.String toHexString(long l)
Method toHexString

Parameters:
l -

toString

public static java.lang.String toString(byte[] ba)
Method toString

Parameters:
ba -

toString

public static java.lang.String toString(byte b)
Method toString

Parameters:
b -

toHexString

public static java.lang.String toHexString(byte[] ba,
                                           int offset,
                                           int length)
converts String to Hex String. Example: niko ->6E696B6F

Parameters:
ba - Description of Parameter
offset - Description of Parameter
length - Description of Parameter
Returns:
Description of the Returned Value

hexStringToByteArray

public static byte[] hexStringToByteArray(java.lang.String strA)
Converts readable hex-String to byteArray

Parameters:
strA -

main

public static void main(java.lang.String[] args)
test and demo for the Convert class

Parameters:
args - none needed