require

abstract fun require(byteCount: Long)(source)

Attempts to fill the buffer with at least byteCount bytes of data from the underlying source and throw EOFException when the source is exhausted before fulfilling the requirement.

If the buffer already contains required number of bytes then there will be no requests to the underlying source.

Parameters

byteCount

the number of bytes that the buffer should contain.

Throws

when the source is exhausted before the required bytes count could be read.

when the source is closed.

when some I/O error occurs.

Samples