Over 500 Magazines for FREE!

Yes! You can subscribe to ALL of them. They will be shipped to your home FREE of cost!
Kindly click here to apply!

PushbackInputStream

Java PushbackInputStream provides ability to push back or unread bytes read from another input stream object. PushbackInputStream works with another input stream in conjunction.

PushbackInputStream class has two internal protected fields. One is "buf" which is buffer and another is "pos" which maintains the position within the "buf" from which the next byte will be read.

PushbackInputStream class provides unread method which actually does the unreading the byte(s).

unread method is overloaded and there are 3 below given versions
1) void unread(int b)
unreads/pushes back single byte by copying it in the front of the buffer.

2) void unread(byte[] b)
unreads/pushes back array of byte by copying it in the front of the buffer.

3) void unread(byte[] b, int offset, int length)
unreads/pushes back portion of byte array by copying it in the front of the buffer.

Post new comment

To combat spam, please enter the code in the image.




Do you have a better example?
We're sure you have hundreds of Java program examples.

Spare some time and submit your java example here even if you think it's too small to contribute.

Could not find what you are looking for? Search Java Examples




Feel Tired? Read Jokes & Inspirational Stories, Play Games!