Class LineNumberInputStream
Object
A InputStream
which sits on top of another stream, tracking the current line and column as it
reads from the underlying stream. Closing the LineNumberInputStream
does not close the
underlying stream, but if the LineNumberInputStream
holds the only remaining reference to the
underlying stream, then discarding the LineNumberInputStream
will cause the underlying stream
to likewise be discarded and thus closed.
You should not read directly from the underlying stream after creating a LineNumberInputStream
on
top of it, as doing so will naturally throw off the LineNumberInputStream
's calculations.
- Source Code:
- View Source
Initializer Summary
init (source :
)InputStream - Creates a new
LineNumberInputStream
.
Field Summary
line :Int - The current line number (starting at 1).
column :Int - The current column number (starting at 1).
tabSize :Int - The width of a tab character.
Instance Method Summary
close():Error?
lines():Iterator<String>
sendTo(OutputStream):Maybe<Int>
readLine():String?
readFully():Array<UInt8>
readFully():String
read(Pointer<Char8>, Int):Int
read(Pointer<Int8>, Int):Int
read(Pointer<UInt8>, Int):Int
read():Char8?
read():Int64?
read():Int32?
read():Int16?
read():Int8?
read():UInt64?
read():UInt32?
read():UInt16?
Initializers
init
(source :InputStream
)
Creates a new LineNumberInputStream
.
- Parameters:
-
-source the underlying stream
Fields
The current line number (starting at 1).
The current column number (starting at 1).
The width of a tab character.
Instance Methods
@override
method read
():UInt8?
Reads and returns a single byte. Blocks until at least one byte is available for reading, or
returns null
if the end of the stream has been reached or in the event of an error.
- Overrides:
- frost.io.InputStream.read