webfunds.utils
Class Hex

java.lang.Object
  |
  +--webfunds.utils.Hex

public class Hex
extends java.lang.Object

Common Hex and digest routines.


Constructor Summary
Hex()
           
 
Method Summary
static java.lang.String data2hex(byte[] data)
           
static byte[] hex2data(java.lang.String str)
           
static boolean isHexAscii(java.lang.String s)
          isHexAscii checks whether a String is made of Hex digits.
static void main(java.lang.String[] args)
           
static java.lang.String printable(byte[] data)
          Useful for printing descriptions, which can be binary.
static java.lang.String quick(byte[] b)
           
static byte toDataNibble(char c)
           
static char toHexChar(int i)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Hex

public Hex()
Method Detail

isHexAscii

public static boolean isHexAscii(java.lang.String s)
isHexAscii checks whether a String is made of Hex digits.

data2hex

public static java.lang.String data2hex(byte[] data)

hex2data

public static byte[] hex2data(java.lang.String str)

toHexChar

public static char toHexChar(int i)

toDataNibble

public static byte toDataNibble(char c)

quick

public static java.lang.String quick(byte[] b)
Returns:
a byte array converted to hex, and truncated beyond some reasonable length, long enough to avoid debugging collisions.

printable

public static java.lang.String printable(byte[] data)
Useful for printing descriptions, which can be binary.
Returns:
a string that is printable, either the original, or a hex conversion of the original if funny chars found.

main

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