All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object
|
+----java.io.InputStream
|
+----java.io.FilterInputStream
|
+----java.io.PushbackInputStream
This functionality is useful when a fragment of code should read an indefinite number of data bytes that are delimited by particular byte values. After reading the terminating byte, the code fragment can "unread" it, so that the next read operation on the input stream will re-read the byte that was pushed back.
mark and
reset methods.
len bytes of data from this input stream
into an array of bytes.
read method on this input stream.
protected byte buf[]
protected int pos
public PushbackInputStream(InputStream in,
int size)
public PushbackInputStream(InputStream in)
public int read() throws IOException
int in the range
0 to 255. If no byte is available
because the end of the stream has been reached, the value
-1 is returned. This method blocks until input data
is available, the end of the stream is detected, or an exception
is thrown.
The read method of PushbackInputStream
returns the just pushed-back character, if there is one, and
otherwise calls the read method of its underlying
input stream and returns whatever value that method returns.
-1 if the end of the
stream is reached.
public int read(byte b[],
int off,
int len) throws IOException
len bytes of data from this input stream
into an array of bytes. This method blocks until at least 1 byte
of input is available.
-1 if there is no more data because the end of
the stream has been reached.
public void unread(int b) throws IOException
read method on this input stream.
public void unread(byte b[],
int off,
int len) throws IOException
public void unread(byte b[]) throws IOException
public int available() throws IOException
The available method of
PushbackInputStream calls the available
method of its underlying input stream; it returns that value if
there is no character that has been pushed back, or that value
plus 1 if there is a character that has been pushed back.
public boolean markSupported()
mark and
reset methods. The markSupported method
of PushbackInputStream always returns false.
true if this stream type supports the
mark and reset methods;
false otherwise.
All Packages Class Hierarchy This Package Previous Next Index