read

fun read(): Int

Reads a single byte from the current position and returns it as an integer in the range 0..255, or -1 if the end of the file has been reached.


fun read(b: ByteArray): Int

Reads up to b.size bytes from the current position into b and returns the number of bytes read, or -1 if no bytes could be read because the end of the file has been reached.


fun read(b: ByteArray, off: Int, len: Int): Int

Reads up to len bytes from the current position into b starting at offset off, returning the number of bytes read or -1 if the end of the file has been reached.