DecodingReader
struct DecodingReader[t: Type, r: Eff]Sourcerc: Region[r]byteReader: tdecoder: java.nio.charset.CharsetDecodermut leftovers: Array[Int8, r]Type of readers that decode bytes into chars.
A DecodingReader adapts a Readable of bytes to a Readable of chars.
byteReader: the underlying byte reader, an instance of Readable where Readable.Elm[t] ~ Int8.
decoder: used to decode bytes read from byteReader.
leftovers: stores bytes that have been consumed from byteReader but have not yet been decoded;
either because they are lead bytes whose continuation bytes have not been read, or
because DecodingReader overestimated the number of bytes needed to fill a char buffer.
Type of readers that decode bytes into chars, and its functions.
Definitions
def read(dest: Array[Char, rb], reader: DecodingReader[t, rr]): Result[IoError, Int32] \ IO + rr + rb + Aef[t] with Readable[t] where Readable.Elm[t] ~ Int8§ SourceReads bytes from the underlying byteReader and decodes the result into dest.
Returns Ok(k) to signify that k chars were successfully read and written to dest.
Guarantees that 0 <= k <= length(dest).
Returns Err(e) if some underlying error occurs.