Class java.io.PushbackInputStream
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class java.io.PushbackInputStream

java.lang.Object
|
   +----java.io.InputStream
|
           +----java.io.FilterInputStream
|
                   +----java.io.PushbackInputStream

public class PushbackInputStream
extends FilterInputStream
An input stream that has a 1 byte push back buffer.

Variable Index

 o pushBack
Push back character.

Constructor Index

 o PushbackInputStream(InputStream)
Creates a PushbackInputStream.

Method Index

 o available()
Returns the number of bytes that can be read.
 o markSupported()
Returns true if this stream type supports mark/reset.
 o read()
Reads a byte of data.
 o read(byte[], int, int)
Reads into an array of bytes.
 o unread(int)
Pushes back a character.

Variables

 o pushBack
protected int pushBack
Push back character.

Constructors

 o PushbackInputStream
public PushbackInputStream(InputStream in)
Creates a PushbackInputStream.
Parameters:
in - the input stream

Methods

 o read
public int read() throws IOException
Reads a byte of data. This method will block if no input is available.
Returns:
the byte read, or -1 if the end of the stream is reached.
Throws: IOException
If an I/O error has occurred.
Overrides:
read in class FilterInputStream
 o read
public int read(byte bytes[],
                  int offset,
                  int length) throws IOException
Reads into an array of bytes. This method blocks until some input is available.
Parameters:
b - the buffer into which the data is read
off - the start offset of the data
len - the maximum number of bytes read
Returns:
the actual number of bytes read, -1 is returned when the end of the stream is reached.
Throws: IOException
If an I/O error has occurred.
Overrides:
read in class FilterInputStream
 o unread
public void unread(int ch) throws IOException
Pushes back a character.
Parameters:
ch - the character to push back.
Throws: IOException
If an attempt to push back more than one character is made.
 o available
public int available() throws IOException
Returns the number of bytes that can be read. without blocking.
Overrides:
available in class FilterInputStream
 o markSupported
public boolean markSupported()
Returns true if this stream type supports mark/reset.
Overrides:
markSupported in class FilterInputStream

All Packages  Class Hierarchy  This Package  Previous  Next  Index