klyn.process.ProcessChannel.readInto
method
public readInto(notnull buffer as Byte[], offset as Long = 0l, length as Long = -1l, timeout as ULong = 0ul) as Long
Description

Reads raw stdout into existing contiguous byte storage without boxing. One reader and one writer may operate concurrently. Calls on the same direction are serialized; the caller owns its buffer during a transfer.

Parameters
ParameterDescription
bufferDestination bytes.
offsetFirst destination index.
lengthMaximum count; -1 uses the remaining buffer.
timeoutMilliseconds to wait; 0 waits until bytes, EOF or close.
Returns

Positive count, 0 on EOF/close or zero length, -1 on timeout.

Throws
  • IOException on a closed channel or an OS read failure.
  • IndexException for an invalid buffer range.
Example

count = channel.readInto(buffer, timeout=50ul)