[]
This class provides a byte input facility from byte buffers. It is similar to the ByteArrayInputStream class, but adds the possibility to add data to the stream after the creation of the object.
<p>Unlike the ByteArrayInputStream this class is not thread safe (i.e. no
two threads can use the same object at the same time, but different objects
may be used in different threads).</p><p>This class can modify the contents of the buffer given to the
constructor, when the addByteArray() method is called.</p>
public class ByteInputBuffer
Name | Description |
---|---|
ByteInputBuffer(byte[]) | Creates a new byte array input stream that reads data from the specified byte array. The byte array is not copied. |
ByteInputBuffer(byte[], int, int) | Creates a new byte array input stream that reads data from the specified byte array. Up to length characters are to be read from the byte array, starting at the indicated offset.
|
Name | Description |
---|---|
addByteArray(byte[], int, int) | Adds the specified data to the end of the byte array stream. This method modifies the byte array buffer. It can also discard the already read input. |
read() | Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, -1 is returned.
|
readChecked() | Reads the next byte of data from this input stream. The value byte is returned as an int in the range 0 to 255. If no byte is available because the end of the stream has been reached, the EOFException exception is thrown.
|
setByteArray(byte[], int, int) | Sets the underlying buffer byte array to the given one, with the given offset and length. If 'buf' is null then the current byte buffer is assumed. If 'offset' is negative, then it will be assumed to be 'off+len', where 'off' and 'len' are the offset and length of the current byte buffer.
|