klyn.io.ConsoleInputStream.readInto
method
public readInto(notnull buffer as Byte[], offset as Long = 0l, length as Long = -1l) as Long
Description

Reads raw bytes into an existing buffer. A positive result may be shorter than length, including for interactive input; zero means EOF. A zero-byte request returns immediately. No source stream is closed or reopened.

Parameters
ParameterDescription
bufferDestination byte array, never null.
offsetFirst destination index.
lengthMaximum bytes; -1 selects the remainder of the buffer.
Returns

Actual byte count, in 0..length.

Throws
  • IndexException for an invalid destination range.
  • NullException for a runtime-null buffer; static null is rejected.
  • IOException for a native input failure.
Example

count = input.readInto(buffer, 8l, 128l)