PushbackInputStream

The PushbackInputStream class provides a pushback buffer so a program can "unread" bytes onto the stream. These may be bytes the program has read from the stream or they may be bytes that come from somewhere else. The next time data is read from the stream, the "unread" bytes are read.

 public void unread(int b) throws IOException
 public void unread(byte[] data, int offset, int length) throws IOException
 public void unread(byte[] data) throws IOException

By default the buffer is only one byte long, and trying to unread more than that throws an IOException. However you can change the default buffer size with the second constructor:

 public PushbackInputStream(InputStream in)
 public PushbackInputStream(InputStream in, int size)


Copyright 2000 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified January 28, 2000