Class: java.io.PushbackReader

A character-stream reader that allows characters to be pushed back into the stream.
Authors:
@author Mark Reinhold
Version:
@version 1.18, 03/12/19
Since:
@since JDK1.1

Inheritance

Superclass tree: Implements:

Methods

  • PushbackReadertop

    public PushbackReader(Reader in)
    Create a new pushback reader with a one-character pushback buffer.
    Parameters:
    @param in The reader from which characters will be read
    Google Code Search
    Stack Overflow
  • PushbackReadertop

    public PushbackReader(Reader in, int size)
    Create a new pushback reader with a pushback buffer of the given size.
    Parameters:
    @param in The reader from which characters will be read
    @param size The size of the pushback buffer
    Exceptions:
    @exception IllegalArgumentException if size is <_ _0="_0" dd="dd">
    Google Code Search
    Stack Overflow
  • closetop

    public void close() throws IOException
    Close the stream.
    Exceptions:
    @exception IOException If an I/O error occurs
    Specified by:
    close from Closeable
    Override hierarchy:
    close from FilterReader
    close from Reader
    Google Code Search
    Stack Overflow
  • marktop

    public void mark(int readAheadLimit) throws IOException
    Mark the present position in the stream. The mark for class PushbackReader always throws an exception.
    Parameters:
    @param 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.
    Exceptions:
    @exception IOException Always, since mark is not supported
    Override hierarchy:
    mark from FilterReader
    mark from Reader
    Google Code Search
    Stack Overflow
  • markSupportedtop

    public boolean markSupported()
    Tell whether this stream supports the mark() operation, which it does not.
    Return:
    @return true if and only if this stream supports the mark operation.
    Override hierarchy:
    markSupported from FilterReader
    markSupported from Reader
    Google Code Search
    Stack Overflow
  • readtop

    public int read() throws IOException
    Read a single character.
    Return:
    @return The character read, or -1 if the end of the stream has been reached
    Exceptions:
    @exception IOException If an I/O error occurs
    Override hierarchy:
    read from FilterReader
    read from Reader
    Google Code Search
    Stack Overflow
  • readtop

    public int read(char[] cbuf, int off, int len) throws IOException
    Read characters into a portion of an array.
    Parameters:
    @param cbuf Destination buffer
    @param off Offset at which to start writing characters
    @param len Maximum number of characters to read
    Return:
    @return The number of characters read, or -1 if the end of the stream has been reached
    Exceptions:
    @exception IOException If an I/O error occurs
    Override hierarchy:
    read from FilterReader
    read from Reader
    Google Code Search
    Stack Overflow
  • readytop

    public boolean ready() throws IOException
    Tell whether this stream is ready to be read.
    Return:
    @return True if the next read() is guaranteed not to block for input, false otherwise. Note that returning false does not guarantee that the next read will block.
    Exceptions:
    @exception IOException If an I/O error occurs
    Override hierarchy:
    ready from FilterReader
    ready from Reader
    Google Code Search
    Stack Overflow
  • resettop

    public void reset() throws IOException
    Reset the stream. The reset method of PushbackReader always throws an exception.
    Exceptions:
    @exception IOException Always, since reset is not supported
    Override hierarchy:
    reset from FilterReader
    reset from Reader
    Google Code Search
    Stack Overflow
  • skiptop

    public long skip(long n) throws IOException
    Skip characters. This method will block until some characters are available, an I/O error occurs, or the end of the stream is reached.
    Parameters:
    @param n The number of characters to skip
    Return:
    @return The number of characters actually skipped
    Exceptions:
    @exception IllegalArgumentException If n is negative.
    @exception IOException If an I/O error occurs
    Override hierarchy:
    skip from FilterReader
    skip from Reader
    Google Code Search
    Stack Overflow
  • unreadtop

    public void unread(int c) throws IOException
    Push back a single character.
    Parameters:
    @param c The character to push back
    Exceptions:
    @exception IOException If the pushback buffer is full, or if some other I/O error occurs
    Google Code Search
    Stack Overflow
  • unreadtop

    public void unread(char[] cbuf) throws IOException
    Push 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.
    Parameters:
    @param cbuf Character array to push back
    Exceptions:
    @exception IOException If there is insufficient room in the pushback buffer, or if some other I/O error occurs
    Google Code Search
    Stack Overflow
  • unreadtop

    public void unread(char[] cbuf, int off, int len) throws IOException
    Push 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.
    Parameters:
    @param cbuf Character array
    @param off Offset of first character to push back
    @param len Number of characters to push back
    Exceptions:
    @exception IOException If there is insufficient room in the pushback buffer, or if some other I/O error occurs
    Google Code Search
    Stack Overflow