4.67. kink/javahost/JAVA_CHANNEL_OUTPUT

4.67.1. JAVA_CHANNEL_OUTPUT.new(Channel ...[$config={}])

`new` makes an output which wraps WritableByteChannel.

See kink/io/OUTPUT for `output` type.

Preconditions

• `Channel` must be a java val.

• The object reference of `Channel` must be an instance of java.nio.channels.WritableByteChannel.

• 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 a `java_channel_output_new_config` val.

4.67.2. type java_channel_output_new_config

The type of config values of JAVA_CHANNEL_OUTPUT.new.

4.67.2.1. C.buffer(...[Buf_size])

If `buffer` method is called, the output does buffering. If `Buf_size` parameter is not given, a default buffer size is used.

If `buffer` is not called, the output does not do buffering.

Precondition

• `Buf_size`, if given, must be a positive int num.

4.67.2.2. C.close_method_handle(Mh)

If `close_method_handle` is called, the output invokes the specified method handle when `close` is called, instead of WritableByteChannel.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.shutdownOutput.

Precondition

• `Close_method_handle` must be a java val of a MethodHandle which takes a single parameter.