read

abstract fun read(into: ByteArray, offset: Int, length: Int): Int

Reads at most length bytes into into at offset, advancing the cursor.

Return

how many bytes were read (at least 1), or -1 at the end of the stream. Never 0: block until a byte exists or the stream ends.