com.generationjava.lang
Class ByteArray

java.lang.Object
  |
  +--com.generationjava.lang.ByteArray

public class ByteArray
extends java.lang.Object

Provides useful methods for manipulating ByteArrays. Todo: Integrate faster byte handling supplied by sclayman.

Author:
bayard@generationjava.com

Constructor Summary
ByteArray(byte[] b)
          Construct an object to contain an array of bytes.
 
Method Summary
static java.lang.String byteArrayToString(byte[] b)
          converts a byte array into a String in hexidecimal form.
static java.lang.String byteToString(byte b)
          given a byte, return a String like: "09" or "AA" etc..
static byte[] longArrayToByteArray(long[] lns)
          Flattern an array of longs into an array of byte.
static byte stringToByte(java.lang.String s)
          given a String like: "09" or "AA" etc, return the relevant byte.
static byte[] stringToByteArray(java.lang.String bstr)
          converts a hexidecimal form of String to a byte array.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ByteArray

public ByteArray(byte[] b)
Construct an object to contain an array of bytes.

Parameters:
b - byte[] of values to contain
Method Detail

byteArrayToString

public static java.lang.String byteArrayToString(byte[] b)
converts a byte array into a String in hexidecimal form.

Parameters:
b - byte[] to turn to a String
Returns:
String of bytes in hexadecimal format

byteToString

public static java.lang.String byteToString(byte b)
given a byte, return a String like: "09" or "AA" etc..

Parameters:
b - byte to turn to a String
Returns:
String of byte in hexadecimal format

stringToByte

public static byte stringToByte(java.lang.String s)
given a String like: "09" or "AA" etc, return the relevant byte.

Parameters:
s - String of byte in hexadecimal format
Returns:
byte value of hexadecimal-string

stringToByteArray

public static byte[] stringToByteArray(java.lang.String bstr)
converts a hexidecimal form of String to a byte array.

Returns:
byte[] values of hexadecimal-string

longArrayToByteArray

public static byte[] longArrayToByteArray(long[] lns)
Flattern an array of longs into an array of byte. The primitive type, 'long' is 8 times the size of a byte.

Returns:
byte value of hexadecimal-string


Copyright © 2000-2003 OSJava. All Rights Reserved.