flix

0.61.0

EncodingWriter

enum EncodingWriter[t: Type]Source
case EncodingWriter({ byteWriter = t, encoder = java.nio.charset.CharsetEncoder })

Adapts a Writable of bytes to a Writable of chars.

byteWriter: the underlying byte writer, an instance of Writable where Writable.Elm[t] ~ Int8. encoder: used to encode bytes before writing them to thebyteReader`.

Instances

instance Writable[EncodingWriter[t]] with Writable[t]Source

Definitions

def wrap(charset: CharacterSet, byteWriter: t): EncodingWriter[t] \ IO Source

Wraps byteWriter in an EncodingWriter.

def write(src: Array[Char, r], writer: EncodingWriter[t]): Result[IoError, Int32] \ r + Aef[t] with Writable[t] where Writable.Elm[t] ~ Int8 Source

Reads k items from src and writes them to writer.

Returns Ok(k) to signify that k items were successfully read and written to r.

Guarantees that 0 <= k <= length(b).

Returns Err(e) if some underlying I/O error occurs.