4.66. kink/javahost/JAVA_CHANNEL_INPUT¶
4.66.1. JAVA_CHANNEL_INPUT.new(Channel ...[$config={}])¶
`new` makes an `input` from ReadableByteChannel.
See kink/io/INPUT for `input` type.
Preconditions
• `Channel` must be a java val.
• The object reference of `Channel` must be an instance of java.nio.channels.ReadableByteChannel.
• If `close_method_handle` method of the config value is called, the object reference of `Channel` must be an instance of the type of the parameter of the specified method handle.
• $config must be a fun which takes `java_channel_input_new_config` val.
4.66.2. type java_channel_input_new_config¶
The type of config values of JAVA_CHANNEL_INPUT.new.
4.66.2.1. C.buffer(...[Buf_size])¶
If `buffer` method is called, the input does buffering. If `Buf_size` parameter is not given, a default buffer size is used.
If `buffer` is not called, the input does not do buffering.
Precondition
• `Buf_size`, if given, must be a positive int num.
4.66.2.2. C.close_method_handle(Mh)¶
If `close_method_handle` is called, the input invokes the specified method handle when `close` is called, instead of ReadableByteChannel.close method.
The method handle is expected to throw an IOException when an IO error occurs.
For example, when you make an input of SocketChannel, you can specify a method handle of SocketChannel.shutdownInput.
Precondition
• `Mh` must be a java val of a MethodHandle which takes a single parameter.