java.lang.Object | |||
↳ | java.io.Reader | ||
↳ | java.io.FilterReader | ||
↳ | java.io.PushbackReader |
A character-stream reader that allows characters to be pushed back into the stream.
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.FilterReader
| |||||||||||
From class
java.io.Reader
|
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new pushback reader with a pushback buffer of the given size.
| |||||||||||
Creates a new pushback reader with a one-character pushback buffer.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Closes the stream and releases any system resources associated with
it.
| |||||||||||
Marks the present position in the stream.
| |||||||||||
Tells whether this stream supports the mark() operation, which it does
not.
| |||||||||||
Reads a single character.
| |||||||||||
Reads characters into a portion of an array.
| |||||||||||
Tells whether this stream is ready to be read.
| |||||||||||
Resets the stream.
| |||||||||||
Skips characters.
| |||||||||||
Pushes back a portion of an array of characters by copying it to the
front of the pushback buffer.
| |||||||||||
Pushes back an array of characters by copying it to the front of the
pushback buffer.
| |||||||||||
Pushes back a single character by copying it to the front of the
pushback buffer.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.io.FilterReader
| |||||||||||
From class
java.io.Reader
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
java.io.Closeable
| |||||||||||
From interface
java.lang.Readable
|
Creates a new pushback reader with a pushback buffer of the given size.
in | The reader from which characters will be read |
---|---|
size | The size of the pushback buffer |
IllegalArgumentException | if size is <= 0 |
---|
Creates a new pushback reader with a one-character pushback buffer.
in | The reader from which characters will be read |
---|
Closes the stream and releases any system resources associated with it. Once the stream has been closed, further read(), unread(), ready(), or skip() invocations will throw an IOException. Closing a previously closed stream has no effect.
IOException | If an I/O error occurs |
---|
Marks the present position in the stream. The mark
for class PushbackReader
always throws an exception.
readAheadLimit | Limit on the number of characters that may be read while still preserving the mark. After reading this many characters, attempting to reset the stream may fail. |
---|
IOException | Always, since mark is not supported |
---|
Tells whether this stream supports the mark() operation, which it does not.
Reads a single character.
IOException | If an I/O error occurs |
---|
Reads characters into a portion of an array.
cbuf | Destination buffer |
---|---|
off | Offset at which to start writing characters |
len | Maximum number of characters to read |
IOException | If an I/O error occurs |
---|
Tells whether this stream is ready to be read.
IOException | If an I/O error occurs |
---|
Resets the stream. The reset
method of
PushbackReader
always throws an exception.
IOException | Always, since reset is not supported |
---|
Skips characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.
n | The number of characters to skip |
---|
IllegalArgumentException | If n is negative. |
---|---|
IOException | If an I/O error occurs |
Pushes back a portion of an array of characters by copying it to the
front of the pushback buffer. After this method returns, the next
character to be read will have the value cbuf[off]
, the
character after that will have the value cbuf[off+1]
, and
so forth.
cbuf | Character array |
---|---|
off | Offset of first character to push back |
len | Number of characters to push back |
IOException | If there is insufficient room in the pushback buffer, or if some other I/O error occurs |
---|
Pushes back an array of characters by copying it to the front of the
pushback buffer. After this method returns, the next character to be
read will have the value cbuf[0]
, the character after that
will have the value cbuf[1]
, and so forth.
cbuf | Character array to push back |
---|
IOException | If there is insufficient room in the pushback buffer, or if some other I/O error occurs |
---|
Pushes back a single character by copying it to the front of the
pushback buffer. After this method returns, the next character to be read
will have the value (char)c
.
c | The int value representing a character to be pushed back |
---|
IOException | If the pushback buffer is full, or if some other I/O error occurs |
---|