com.ibm.etill.framework.io
Class ByteArray

java.lang.Object
  |
  +--com.ibm.etill.framework.io.ByteArray

public class ByteArray
extends Object

The ByteArray class encapsulates an array of byte and provides a function for converting the array to a printable string with unprintable characters translated to {0xHH}, where HH is the hexidecimal byte code. It also provides function for converting the array to a printable hexidecimal string.


Constructor Summary
ByteArray(byte[] ba)
          Constructor that takes an array of byte.
ByteArray(byte[] ba, int offset, int len)
          Constructor that takes a subset of an array of byte starting at offset into ba for len bytes.
 
Method Summary
 String toHexDump()
          NOT Implemented
 String toHexString()
          Converts this into a printable hexidecimal string
 String toString()
          Converts this into a printable string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteArray

public ByteArray(byte[] ba)
Constructor that takes an array of byte.
Parameters:
ba - array of bytes
Throws:
NullPointerException - If ba is null

ByteArray

public ByteArray(byte[] ba,
                 int offset,
                 int len)
Constructor that takes a subset of an array of byte starting at offset into ba for len bytes.
Parameters:
ba - array of bytes
offset - offset into ba where subset begins
len - length of the subset of bytes. len must be >= 0 and < ba.length and offset + len must be >=0 and < ba.length.
Throws:
NullPointerException - If ba is null and len >= 0
ArrayIndexOutOfBoundsException - If offset < 0 or (offset + len) >= ba.length
Method Detail

toString

public String toString()
Converts this into a printable string. Printable characters are left as is. Characters < 20 and > 127 are displayed as {0xHH}
Overrides:
toString in class Object
Returns:
String a printable string

toHexString

public String toHexString()
Converts this into a printable hexidecimal string
Returns:
a printable hexidecimal string

toHexDump

public String toHexDump()
NOT Implemented
Returns:
null