lib/core: Added new `append_substring` service to avoid creating ephemeral instances
[nit.git] / lib / core / stream.nit
index 19ed842..5ad8d75 100644 (file)
@@ -66,7 +66,7 @@ abstract class Reader
        super Stream
 
        # Decoder used to transform input bytes to UTF-8
-       var decoder: Decoder = utf8_decoder is writable
+       var decoder: Codec = utf8_codec is writable
 
        # Reads a character. Returns `null` on EOF or timeout
        fun read_char: nullable Char is abstract
@@ -406,7 +406,7 @@ abstract class Writer
        super Stream
 
        # The coder from a nit UTF-8 String to the output file
-       var coder: Coder = utf8_coder is writable
+       var coder: Codec = utf8_codec is writable
 
        # Writes bytes from `s`
        fun write_bytes(s: Bytes) is abstract
@@ -417,6 +417,9 @@ abstract class Writer
        # Write a single byte
        fun write_byte(value: Byte) is abstract
 
+       # Writes a single char
+       fun write_char(c: Char) do write(c.to_s)
+
        # Can the stream be used to write
        fun is_writable: Bool is abstract
 end