4.61. kink/io/WRAP_SCANNER

Provides a scanner implementation wrapping input.

4.61.1. WRAP_SCANNER.new(Input Charset)

`new` makes a scanner+input, which reads bin from `Input` and decodes them using `Charset`.

Preconditions:

• `Input` must be an input

• `Charset` must be a charset

The result supports both `scanner` type and `input` type.

Input method `read` reads bytes from the underlying `Input`.

Scanner methods such as `scan_rune` and `scan_line` converts bytes read from the underlying `Input` to runes using `Charset`.

Example:

:WRAP_SCANNER.require_from('kink/io/')
:BIN_INPUT.require_from('kink/io/')
:BIN.require_from('kink/')
:CHARSET.require_from('kink/charset/')

:In <- BIN_INPUT.new(BIN.of(102 111 111 10))
:S <- WRAP_SCANNER.new(In CHARSET.utf8)

# the result suppors input
stdout.print_line(S.read(1).repr) # => [(bin 0x66)]

# the result suppors scanner
stdout.print_line(S.scan_line.repr) # => ["oo\n"]