fun peekTo(
    destination: Memory,
    destinationOffset: Long,
    offset: Long,
    min: Long,
    max: Long
): Long

Overrides Input.peekTo

Copy at least min but up to max bytes to the specified destination buffer from this input skipping offset bytes. If there are not enough bytes available to provide min bytes then it fails with an exception. It is safe to specify max > destination.writeRemaining but min shouldn’t be bigger than the destination free space. This function could trigger the underlying source reading that may lead to blocking I/O. It is safe to specify too big offset but only if min = 0, fails otherwise. This function usually copy more bytes than min (unless max = min).


destination - to write bytes

offset - to skip input

min - bytes to be copied, shouldn’t be greater than the buffer free space. Could be 0.

max - bytes to be copied even if there are more bytes buffered, could be Int.MAX_VALUE.


Throwable - when not enough bytes available to provide

Return number of bytes copied to the destination possibly 0

fun peekTo(buffer: IoBuffer): Int

Overrides Input.peekTo

Deprecated: Binary compatibility.

Copy available bytes to the specified buffer but keep them available. If the underlying implementation could trigger bytes population from the underlying source and block until any bytes available

Very similar to readAvailable but don’t discard copied bytes.

Return number of bytes were copied