read

open override fun read(buffer: ByteArray, offset: Int, length: Int): Int(source)

Reads up to length bytes from the current position into buffer starting at offset.

Advances the stream position by the number of bytes actually read.

Return

the number of bytes read into buffer, or -1 if the end of the stream has been reached.

Parameters

buffer

the destination byte array into which data is read.

offset

the start offset in buffer at which the data is written.

length

the maximum number of bytes to read.


open override fun read(byteBuffer: ByteBuffer): Int(source)

Reads a sequence of bytes from this source at the current position into byteBuffer.

Up to byteBuffer.remaining() bytes are transferred, and both this source's position and byteBuffer.position() are advanced by the number of bytes read.

Return

the number of bytes read, or -1 if the source has reached end-of-stream.

Parameters

byteBuffer

the destination buffer into which bytes are transferred.