BufferedInputStream class methods in Java

java.io.BufferedInputStream

A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the input and to support the mark and reset methods.


Some methods of BufferedInputStream class


available()This method returns an estimate of the number of bytes that can be read (or skipped over) from this input stream without blocking by the next invocation of a method for this input stream.


close()This method closes this input stream and releases any system resources associated with the stream.



mark(int)This method sees the general contract of the mark method of InputStream.



markSupported()This method tests if this input stream supports the mark and reset methods.


read()This method sees the general contract of the read method of InputStream.

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


read(byte[], int, int)This method reads bytes from this byte-input stream into the specified byte array, starting at the given offset.


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


readNBytes(int)This method reads up to a specified number of 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()If mark pos is -1(no mark has been set or the mark has been invalidated), an IOException is thrown. Otherwise, pos is set equal to mark pos.


skip(long)This method tries to skip the n number of bytes.


skipNBytes(long)This method skips over and discards exactly n bytes of data 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