Returns an Input
with the chunk of data appended to the currently
readable window.
Returns an Input
with the chunk of data appended to the currently
readable window. If last
is true, then the returned Input
's isLast
method returns true
. Any data available in the current Input
, but
prior to this Input
's mark
will not be available in the returned
Input
.
Returns the character at the given position.
Returns the character at the given position. This method will do some aggressive bounds checking.
the currently readable window into the stream
Returns a copy of this Input
where isLast
is true.
true if this window covers the end of the stream
Returns the index of the first position that cannot be read.
Returns the index of the first position that cannot be read. If isLast
is true
, then this is the length of the stream.
the position in the stream we are able to truncate data to
Returns an Input
whose mark
is at the given position.
the offset, in chars, of the start of data
in the stream
Returns the substring between from
(inclusive) and until
(exclusive).
Returns the substring between from
(inclusive) and until
(exclusive).
It is expected that mark <= from <= until <= limit
.
Returns the character data between mark
and limit
.
Returns the character data between mark
and limit
. This is equivalent
to calling input.substring(input.mark, input.limit)
.
An immutable window into a stream of character data. The size of the window is determined by 2 methods:
marked(pos)
andappend(chunk)
, which shrink and expand the window respectively. All positions used withInput
are always relative to the entire stream, though only positions within the current window are valid at any given point in time.The method
marked
returns a newInput
which may drop all data before the marked position. Accessing data before the marked position in the returnedInput
is undefined and should be expected to fail in hilarious ways.The method
append
is used to append new chunks of data from the stream onto the input. TheInput
returned byappend
will have all its data up-tomark
removed.