binary - 

Read and write binary data with any Reader and Writer

var w = new FileWriter.open("/tmp/data.bin")
w.write "hello"
w.write_int64 123456789
w.write_byte 3u8
w.write_float 1.25
w.write_double 1.234567
w.write_bits(true, false, true)
assert w.last_error == null
w.close

var r = new FileReader.open("/tmp/data.bin")
assert r.read(5) == "hello"
assert r.read_int64 == 123456789
assert r.read_byte == 3u8
assert r.read_float == 1.25
assert r.read_double == 1.234567

var bits = r.read_bits
assert bits[0] and not bits[1] and bits[2]

assert r.last_error == null
r.close

Content