X-Git-Url: http://nitlanguage.org diff --git a/lib/core/stream.nit b/lib/core/stream.nit index 217e9c8..80b96f0 100644 --- a/lib/core/stream.nit +++ b/lib/core/stream.nit @@ -55,7 +55,7 @@ abstract class Stream # Used to inform `self` that the operations are over. # Specific streams can use this to free some resources. # - # Is automatically invoked at the end of `woth` structures. + # Is automatically invoked at the end of `with` structures. # # call `close` by default. fun finish do close @@ -668,18 +668,24 @@ end class StringWriter super Writer - private var content = new Array[String] - redef fun to_s do return content.plain_to_s + private var content = new Buffer + redef fun to_s do return content.to_s redef fun is_writable do return not closed redef fun write_bytes(b) do - content.add(b.to_s) + content.append(b.to_s) end redef fun write(str) do assert not closed - content.add(str.to_s) + content.append(str) + end + + redef fun write_char(c) + do + assert not closed + content.add(c) end # Is the stream closed?