InputStream class in Methods

InputStream class in is used for stream byte input. Methods defined by InputStream class:

read method: To read characters read( ) method is used. Read method is used to read a character from an input stream. It returns an integer value; it returns -1 for end of stream.


int read( )

To read a buffer:


int read(byte buffer[ ])

To read a buffer to nbytes:


int read(byte buffer[ ], int offset, int nbytes)

close method: It is used to close an input stream.


void close( )

available( ) method: It is used to return number of bytes available for reading.


int available( )

mark( ) method: It is used to place a mark at a current point in input stream. This mark remains until nbytes are read.


void mark(int nbytes)

markSupported( ) method: It returns true if methods mark( ) and reset( ) are supported by calling stream.


boolean markSupported( )

reset( ) method: It is used to reset input pointer to a mark which was set before.


void reset( )

skip( ) method: It is used to skip nbytes of input.


long skip(long nbytes)

Leave a Reply