ByteArrayInputStream class methods in Java

java.io.ByteArrayInputStream

A ByteArrayInputStream contains an internal buffer that contains bytes that may be read from the stream.


Some methods of ByteArrayInputStream class.

available()This method returns the number of remaining bytes that can be read (or skipped over) from this input stream.


close(): This method closes the buffer.


mark(int)This method set the currently marked position in the stream.


markSupported()This method tests if this InputStream supports mark/reset.


read()This method reads the next byte of data from this input stream.


read(byte[], int, int)This method reads up to len bytes of data into an array of bytes from this input stream.


readAllBytes()This method reads all remaining bytes from the input stream.


readNBytes(byte[], int, int)This method reads the requested number of bytes from the input stream into the given byte array.


reset()This method resets the buffer to the marked position.


skip(long)This method skips n bytes of input from this input stream.


transferTo(OutputStream)This method reads all bytes from this input stream and writes the bytes to the given output stream in the order that they are read.


No comments:

Post a Comment