de.cscc.crypto.util
Class ByteUtil

java.lang.Object
  extended byde.cscc.crypto.util.ByteUtil

public final class ByteUtil
extends Object

ByteUtil Class. Class that holds only static methods to convert bytes and byte arrays to Strings. These Strings holds the hex or binary representation of the converted byte or byte arrays. This class can't be instance, because its constructor is private.

Version:
$Revision: 1.2 $
Author:
Uwe Günther

Method Summary
static String toBin(byte[] in)
          Converts byte[] to binary representation.
static String toBin(int in)
          Converts byte to binary representation.
static String toHex(byte in)
          Converts byte to hex representation.
static String toHex(byte[] in)
          Converts byte[] to hex representation.
static long toLong(byte[] input, int inputOffset)
          Converts byte[8] to long representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

toBin

public static String toBin(int in)
Converts byte to binary representation.

Parameters:
in - byte that will be converted.
Returns:
String with hex representation of in.

toBin

public static String toBin(byte[] in)
Converts byte[] to binary representation.

Parameters:
in - byte[] that will be converted.
Returns:
String with hex representation of in.

toHex

public static String toHex(byte in)
Converts byte to hex representation.

Parameters:
in - byte that will be converted.
Returns:
String with hex representation of in.

toHex

public static String toHex(byte[] in)
Converts byte[] to hex representation.

Parameters:
in - byte[] that will be converted.
Returns:
String with hex representation of in.

toLong

public static long toLong(byte[] input,
                          int inputOffset)
                   throws IllegalBlockSizeException
Converts byte[8] to long representation.

Parameters:
input - byte[8] that will be converted.
inputOffset - the offset in input where input starts.
Returns:
the long representation.
Throws:
IllegalBlockSizeException - if input length lesser than 8.


Copyright © 2001, 2002 by Uwe Günther. See the COPYING file for more details. Browse the source as HTML.