Class: java.io.PushbackReader
- public class PushbackReader
- extends FilterReader
A character-stream reader that allows characters to be pushed back into the
stream.
Inheritance
Superclass tree:- java.lang.Object
- java.io.Reader
- java.io.FilterReader
- java.io.PushbackReader
Methods
-
PushbackReadertop
public PushbackReader(Reader in)Creates a new pushback reader with a one-character pushback buffer. -
PushbackReadertop
public PushbackReader(Reader in, int size)Creates a new pushback reader with a pushback buffer of the given size. -
closetop
public void close() throws IOExceptionCloses 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. -
marktop
public void mark(int readAheadLimit) throws IOExceptionMarks the present position in the stream. Themarkfor classPushbackReaderalways throws an exception.- Override hierarchy:
- mark from FilterReader
- mark from Reader
-
markSupportedtop
public boolean markSupported()Tells whether this stream supports the mark() operation, which it does not.- Override hierarchy:
- markSupported from FilterReader
- markSupported from Reader
-
readtop
public int read() throws IOExceptionReads a single character.- Override hierarchy:
- read from FilterReader
- read from Reader
-
readtop
public int read(char[] cbuf, int off, int len) throws IOExceptionReads characters into a portion of an array.- Override hierarchy:
- read from FilterReader
- read from Reader
-
readytop
public boolean ready() throws IOExceptionTells whether this stream is ready to be read.- Override hierarchy:
- ready from FilterReader
- ready from Reader
-
resettop
public void reset() throws IOExceptionResets the stream. Theresetmethod ofPushbackReaderalways throws an exception.- Override hierarchy:
- reset from FilterReader
- reset from Reader
-
skiptop
public long skip(long n) throws IOExceptionSkips characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.- Override hierarchy:
- skip from FilterReader
- skip from Reader
-
unreadtop
public void unread(int c) throws IOExceptionPushes 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. -
unreadtop
public void unread(char[] cbuf) throws IOExceptionPushes 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 valuecbuf[0], the character after that will have the valuecbuf[1], and so forth. -
unreadtop
public void unread(char[] cbuf, int off, int len) throws IOExceptionPushes 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 valuecbuf[off], the character after that will have the valuecbuf[off+1], and so forth.
