Home » Java PushbackReader Class

Java PushbackReader Class

by Online Tutorials Library

Java PushbackReader Class

Java PushbackReader class is a character stream reader. It is used to pushes back a character into stream and overrides the FilterReader class.

Class declaration

Let’ s see the declaration for java.io.PushbackReader class:

Class Methods

Method Description
int read() It is used to read a single character.
void mark(int readAheadLimit) It is used to mark the present position in a stream.
boolean ready() It is used to tell whether the stream is ready to be read.
boolean markSupported() It is used to tell whether the stream supports mark() operation.
long skip(long n) It is used to skip the character.
void unread (int c) It is used to pushes back the character by copying it to the pushback buffer.
void unread (char[] cbuf) It is used to pushes back an array of character by copying it to the pushback buffer.
void reset() It is used to reset the stream.
void close() It is used to close the stream.

Example of PushbackReader class

Output

You may also like