4.51. kink/io/BIN_INPUT

BIN_INPUT mod provides input implementation which extracts bytes from bin vals.

4.51.1. BIN_INPUT.new(Bin)

BIN_INPUT.new makes an input which extracts bytes from Bin.

Bin must be a bin.

Example:

:BIN.require_from('kink/')
:BIN_INPUT.require_from('kink/io/')
:INPUT.require_from('kink/io/')

:In <- BIN_INPUT.new(BIN.of(1 2 3 4 5 6))
stdout.print_line(In.read(3).repr)          # => [(bin 0x01 0x02 0x03)]
stdout.print_line(INPUT.read_all(In).repr)  # => (bin 0x04 0x05 0x06)

The result input does not cause IO errors.

.close method of the result input does nothing, thus you don't have to call .close for the input.