6.66. kink/javahost/JAVA_CHANNEL_INPUT

Provides `input` based on Java ReadableByteChannel.

6.66.1. JAVA_CHANNEL_INPUT.new(Channel ...[$config={}])

`new` makes an `input` from java.nio.channels.ReadableByteChannel.

Config methods:

• C.buffer(...[Max_buf_size])

• C.close_method_handle(Close_mh): default = ReadableByteChannel::close

Buffering

If C.buffer is called, the result `input` performs userspace buffering. If `Max_buf_size` is given, the buffer size does not exceed `Max_buf_size` in byte length.

If C.buffer is not called, the result `input` does not perform userspace buffering.

Closing of the input

When `close` method of the result `input` is called, `Close_mh` is invoked with `Channel` as the argument.

If `Close_mh` throws an IOException during its invocation, `close` ends with an IO error.

Preconditions

`Channel` must be a `java` value whose objectReference is a ReadableByteChannel. The objectReference must also be an instance of the parameter type of `Close_mh`.

`Max_buf_size` must be a positive int num.

`Close_mh` must be a `java` value of a MethodHandle, which takes a single parameter.

Invocation of `Close_mh` must throw an IOException when an IO error occurs.