read

open override fun read(): Int

Reads a single character.

Return

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

Throws

IOException

If an I/O error occurs


open override fun read(cbuf: CharArray, off: Int, len: Int): Int

Reads characters into a portion of an array.

This method implements the general contract of the corresponding 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.

Return

{@inheritDoc}

Parameters

cbuf

{@inheritDoc}

off

{@inheritDoc}

len

{@inheritDoc}

Throws

IOException

{@inheritDoc}