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.
-
pushBack
- Push back character.
-
PushbackInputStream(InputStream)
- Creates a PushbackInputStream.
-
available()
- Returns the number of bytes that can be read.
-
markSupported()
- Returns true if this stream type supports mark/reset.
-
read()
- Reads a byte of data.
-
read(byte[], int, int)
- Reads into an array of bytes.
-
unread(int)
- Pushes back a character.
pushBack
protected int pushBack
- Push back character.
PushbackInputStream
public PushbackInputStream(InputStream in)
- Creates a PushbackInputStream.
- Parameters:
- in - the input stream
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
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
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.
available
public int available() throws IOException
- Returns the number of bytes that can be read.
without blocking.
- Overrides:
- available in class FilterInputStream
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