4.52. kink/io/BIN_OUTPUT¶
4.52.1. BIN_OUTPUT.new¶
`new` makes an output which builds bin from bytes.
The result output also has `bin` method which returns the built bin.
Example:
:BIN_OUTPUT.require_from('kink/io/')
:BIN.require_from('kink/')
:make_bin <- {
:Out = BIN_OUTPUT.new
Out.write(BIN.of(1 2 3))
Out.write(BIN.of(4))
Out.close
Out.bin
}
stdout.print_line(make_bin.repr) # => BIN.of(0x01 0x02 0x03 0x04)
.close and .flush method do nothing for the result output, thus you don't have to call .close for the output.