io.aviso.writer
The StringWriter protocol is used as the target of any written output.
into-string
(into-string f & params)
Creates a StringBuilder
and passes that as the first parameter to the function, along with the other parameters.
Returns the value of the StringBuilder
after invoking the function.
StringWriter
protocol
May receive strings, which are printed, or stored.
StringWriter
is extended onto java.lang.Appendable
, a common interface implemented by both PrintWriter
and StringBuilder
(among many others).
members
flush-writer
(flush-writer this)
Flushes output to the StringWriter
, where supported.
write-string
(write-string this string)
Writes the string to the StringWriter
.
write
(write writer value)
(write writer value & values)
Constructs a string from the values (with no seperator) and writes the string to the StringWriter.
This is used to get around the fact that protocols do not support varadic parameters.
writeln
(writeln writer)
(writeln writer & values)
Constructs a string from the values (with no seperator) and writes the string to the StringWriter
, followed by an end-of-line terminator, then flushes the writer.