6.56. kink/io/BIN_INPUT

Provides `input` implementation which extracts bytes from `bin`.

6.56.1. BIN_INPUT.new(Bin)

`new` returns an `input` which extracts bytes from `Bin`.

If the `input` is closed, read operation causes an IO error, like other implementations based on system resources.

Precondition

`Bin` must be a `bin`.

Example

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

CONTROL.with_finally{(:finally)
  :In = BIN_INPUT.new(BIN.of(1 2 3 4 5 6))
  finally{ In.close }
  stdout.print_line(In.read(3).repr)   # => (bin 0x01 0x02 0x03)
  stdout.print_line(In.read_all.repr)  # => (bin 0x04 0x05 0x06)
}