![]() |
VOOZH | about |
ByteArrayInputStream class of java.io package contains all the buffers, containing bytes to be read from the Input Stream. There is no IO exception in case of ByteArrayInputStream class methods. Methods of this class can be called even after closing the Stream, there is no effect of it on the class methods. The class view is as follows:
--> java.io Package --> ByteArrayInputStream Class
Syntax:
public class ByteArrayInputStream extends InputStream
There are certain Fields:
| Constructor | Action Performed |
|---|---|
| ByteArrayInputStream(byte[] buffer) | It creates ByteArrayInputStream to use buffer array - "buffer". |
| ByteArrayInputStream(byte[] buf, int offset, int length) | It creates ByteArrayInputStream that uses some part of "buffer" i.e. buffer array |
| Method | Action Performed |
|---|---|
| available() | It tells the total number of bytes from the input stream to be read. |
| close() | It closes the input stream and releases system resources. |
| mark() | It marks the current position of the input stream which means setting the read limit. |
| markSupported() | It tests if this input stream supports the mark and reset method. |
| read() | It reads the next byte of data from the input stream. |
| reset() | It repositions the input stream to the marked position and is called the mark() method |
| skip() | Skips the "args" in the input stream. |
Use of available() method : 5 Char : G Char : E Char : E skip() method comes to play mark() method comes to play Char : S markSupported() : true reset() invoked Char : K Char : S geek.markSupported() supported reset() : true