Class ByteArrayByteStream
java.lang.Object
tools.data.ByteArrayByteStream
Provides for an abstraction layer for an array of bytes.
- Since:
- Revision 326
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the number of bytes available from the stream.longReturns the numbers of bytes read from the stream.longGets the current position of the stream.intreadByte()Reads a byte from the current position.voidseek(long offset) Seeks the pointer the the specified position.toString()Returns the current stream as a hexadecimal string of values.toString(boolean b)
-
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
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
-
toString
-
available
public long available()Returns the number of bytes available from the stream.- Returns:
- Number of bytes available as a long integer.
-