Javatpoint Logo
Javatpoint Logo

Java PushbackInputStream Class

Java PushbackInputStream class overrides InputStream and provides extra functionality to another input stream. It can unread a byte which is already read and push back one byte.

Class declaration

Let's see the declaration for java.io.PushbackInputStream class:

Class Methods

It is used to test if the input stream support mark and reset method.
MethodDescription
int available()It is used to return the number of bytes that can be read from the input stream.
int read()It is used to read the next byte of data from the input stream.
boolean markSupported()
void mark(int readlimit)It is used to mark the current position in the input stream.
long skip(long x)It is used to skip over and discard x bytes of data.
void unread(int b)It is used to pushes back the byte by copying it to the pushback buffer.
void unread(byte[] b)It is used to pushes back the array of byte by copying it to the pushback buffer.
void reset()It is used to reset the input stream.
void close()It is used to close the input stream.

Example of PushbackInputStream class

Output:





Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


Preparation


B.Tech / MCA