Class ByteArrayByteStream

java.lang.Object
tools.data.ByteArrayByteStream

public class ByteArrayByteStream extends Object
Provides for an abstraction layer for an array of bytes.
Since:
Revision 326
  • Constructor Details

    • ByteArrayByteStream

      public ByteArrayByteStream(byte[] arr)
      Class constructor.
      Parameters:
      arr - Array of bytes to wrap the stream around.
  • Method Details

    • getPosition

      public long getPosition()
      Gets the current position of the stream.
      Returns:
      The current position of the stream.
    • seek

      public void seek(long offset) throws IOException
      Seeks the pointer the the specified position.
      Parameters:
      offset - The position you wish to seek to.
      Throws:
      IOException
    • getBytesRead

      public long getBytesRead()
      Returns the numbers of bytes read from the stream.
      Returns:
      The number of bytes read.
    • readByte

      public int readByte()
      Reads a byte from the current position.
      Returns:
      The byte as an integer.
    • toString

      public String toString()
      Returns the current stream as a hexadecimal string of values. Shows the entire stream, and the remaining data at the current position.
      Overrides:
      toString in class Object
      Returns:
      The current stream as a string.
      See Also:
    • toString

      public String toString(boolean b)
    • available

      public long available()
      Returns the number of bytes available from the stream.
      Returns:
      Number of bytes available as a long integer.