byte_array_reader


byte_array_reader(ba, @key transcoder)
      

Return a new input stream that will draw its input from the byte array ba.

The byte array must be an array of unsigned bytes. If transcoder is present, it must be a transcoder object and byte_array_reader will return a textual input stream which will be decoded with transcoder. Otherwise, a binary input stream is returned.

Examples:


let br = byte_array_reader(#u8[123, 100, 125])
read_byte(br)
// 123
read_n_bytes(2, br)
// #u8[100, 125]

let br = byte_array_reader(#u8[104, 101, 108, 108, 111], transcoder = transcoder('ASCII))
read_char(br)
// \h
read_n_chars(4, br)
// ello
      

Also see:

byte_array_writer


Core Module Index | Contents