read

open suspend fun read(): Int

Reads a single character.

Subclasses that intend to support efficient single-character input should override this method.

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

if an I/O error occurs


open suspend fun read(b: CharArray): Int

Reads characters into an array.

Return

The total number of characters read into the buffer, or -1 if there is no more data because the end of the stream has been reached

Parameters

b

the buffer into which the data is read

Throws

if an I/O error occurs


open suspend fun read(b: CharArray, off: Int, len: Int): Int

Reads characters into a portion of an array.

Return

The total number of characters read into the buffer, or -1 if there is no more data because the end of the stream has been reached

Parameters

b

the buffer into which the data is read

off

the start offset in the destination array b

len

the maximum number of characters read


abstract suspend fun read(b: CharBuffer): Int

Attempts to read characters into the specified character buffer. The buffer is used as a repository of characters as-is: the only changes made are the results of a put operation. No flipping or rewinding of the buffer is performed.

Return

The total number of characters read into the buffer, or -1 if there is no more data because the end of the stream has been reached

Parameters

b

the buffer into which the data is read

Throws

if an I/O error occurs

if the buffer is read-only