Class IndentedOutputStream
Object
An output stream which indents the lines it writes. IndentedOutputStream
sits "on top of" another
stream, directing its output to the underlying stream. Closing the IndentedOutputStream
does not
directly close the underlying stream, but if the IndentedOutputStream
holds the only remaining
reference to the underlying stream, then discarding the IndentedOutputStream
will cause the
underlying stream to likewise be discarded and thus closed.
It is possible to continue writing directly to the underlying stream despite having created an
IndentedOutputStream
on top of it; naturally, such writes will not be processed by the
IndentedOutputStream
and thus may interact badly with it.
- Source Code:
- View Source
Initializer Summary
init (out :
)OutputStream - Creates a new
IndentedOutputStream
.
Field Summary
level :Int - The current indentation level, in units of
indentSize
. indentSize :Int - The number of spaces represented by each increment of
level
.
Instance Method Summary
write (b :
):UInt8 Error? - Writes a single byte.
write (ptr :
,Pointer<UInt8> count :
):Int Error? - Writes a block of data to this stream.
close():Error?
flush():Error?
printLine():Error?
printLine(Object):Error?
printLine(String):Error?
print(Object):Error?
print(String):Error?
write(Char8):Error?
write(Array<Char8>, Int):Error?
write(Array<Int8>, Int):Error?
write(Array<UInt8>, Int):Error?
write(Pointer<Char8>, Int):Error?
write(Pointer<Int8>, Int):Error?
write(Int64):Error?
write(Int32):Error?
write(Int16):Error?
write(Int8):Error?
write(UInt64):Error?
write(UInt32):Error?
write(UInt16):Error?
Initializers
init
(out :OutputStream
)
Creates a new IndentedOutputStream
.
- Parameters:
-
-out the underlying output stream
Fields
The current indentation level, in units of indentSize
. Each line written to the underlying
stream will be prefixed by indentSize * level
spaces.
The number of spaces represented by each increment of level
. Defaults to 4
.
Instance Methods
@override
method write
(ptr :Pointer<UInt8>
,
count :Int
):Error?
Writes a block of data to this stream.
- Parameters:
-
-ptr Pointer to the data to write
-count number of bytes to write
- Overrides:
- frost.io.OutputStream.write