+ var arr = new Array[Bool]
+ for i in [7 .. 0].step(-1) do
+ arr.push(((int >> i) & 1u8) != 0u8)
+ end
+ return arr
+ end
+
+ # Read a null terminated string
+ #
+ # To be used with `Writer::write_string`.
+ #
+ # Returns a truncated string when an error is pending (`last_error != null`).
+ fun read_string: String
+ do
+ var buf = new Bytes.empty
+ loop
+ var byte = read_byte
+ if byte == null or byte == 0u8 then
+ return buf.to_s
+ end
+ buf.add byte
+ end
+ end
+
+ # Read the length as a 64 bits integer, then the content of the block
+ #
+ # To be used with `Writer::write_block`.
+ #
+ # Returns a truncated string when an error is pending (`last_error != null`).
+ fun read_block: String
+ do
+ var length = read_int64
+ if length == 0 then return ""
+ return read_bytes(length).to_s