The ByteArrayInputStream is composed of two words: ByteArray and InputStream. As the name suggests, it can be used to read byte array as input stream.
Java ByteArrayInputStream class contains an internal buffer which is used to read byte array as stream. In this stream, the data is read from a byte array.
The buffer of ByteArrayInputStream automatically grows according to data.
public class ByteArrayInputStream extends InputStream
|ByteArrayInputStream()||Creates a new byte array input stream which uses ary as its buffer array.|
|ByteArrayInputStream(byte ary, int offset, int len)||Creates a new byte array input stream which uses ary as its buffer array that can read up to specified len bytes of data from an array.|
|int available()||It is used to return the number of remaining bytes that can be read from the input stream.|
|int read()||It is used to read the next byte of data from the input stream.|
|int read(byte ary, int off, int len)||It is used to read up to len bytes of data from an array of bytes in the input stream.|
|boolean markSupported()||It is used to test the input stream for mark and reset method.|
|long skip(long x)||It is used to skip the x bytes of input from the input stream.|
|void mark(int readAheadLimit)||It is used to set the current marked position in the stream.|
|void reset()||It is used to reset the buffer of a byte array.|
Near fortis Hostipal