Constructors

Methods

Constructors

Methods

  • Reads a single character.

    Returns number

    The character read, as an integer in the range 0 to 65535 (0x00-0xffff), or -1 if the end of the stream has been reached

    Exception

    IOException If an I/O error occurs

  • Reads characters into a portion of an array.

    This method implements the general contract of the corresponding Reader#read(char[], int, int) read method of the Reader class. As an additional convenience, it attempts to read as many characters as possible by repeatedly invoking the read method of the underlying stream. This iterated read continues until one of the following conditions becomes true:

    The specified number of characters have been read,

    The read method of the underlying stream returns -1, indicating end-of-file, or

    The ready method of the underlying stream returns false, indicating that further input requests would block.

    If the first read on the underlying stream returns -1 to indicate end-of-file then this method returns -1. Otherwise this method returns the number of characters actually read.

    Subclasses of this class are encouraged, but not required, to attempt to read as many characters as possible in the same fashion.

    Ordinarily this method takes characters from this stream's character buffer, filling it from the underlying stream as necessary. If, however, the buffer is empty, the mark is not valid, and the requested length is at least as large as the buffer, then this method will read characters directly from the underlying stream into the given array. Thus redundant BufferedReaders will not copy data unnecessarily.

    Parameters

    • cbuf: string[]

      Destination buffer

    • off: number

      Offset at which to start storing characters

    • len: number

      Maximum number of characters to read

    Returns number

    The number of characters read, or -1 if the end of the stream has been reached

    Exception

    IOException If an I/O error occurs

    Exception

    IndexOutOfBoundsException {@inheritDoc }

  • Reads a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), a carriage return followed immediately by a line feed, or by reaching the end-of-file (EOF).

    Returns string

    A String containing the contents of the line, not including any line-termination characters, or null if the end of the stream has been reached without reading any characters

    Exception

    IOException If an I/O error occurs

    See

    java.nio.file.Files#readAllLines

  • Tells whether this stream is ready to be read. A buffered character stream is ready if the buffer is not empty, or if the underlying character stream is ready.

    Returns boolean

    Exception

    IOException If an I/O error occurs