BufReader
Definitions
def peek(bufReader: BufReader[a, t, r]): Result[IoError, Option[Elm[t]]] \ Aef[t] + r with Readable[t] where Readable.Elm[t] ~ a
SourceReturns Ok(Some(x))
where x is the next value to be read, or Ok(None)
if the bufReader
is empty.
Does not advance the bufReader
.
Returns Err(err)
if there is an IO error.
def read(dest: Array[Elm[t], rb], bufReader: BufReader[a, t, rr]): Result[IoError, Int32] \ rb + rr + Aef[t] with Readable[t] where Readable.Elm[t] ~ a
SourceReads k
items from the underlying Readable
into dest
, storing items read into
the internal buffer.
Returns Ok(k)
to signify that k
items were successfully read and written to dest
.
Guarantees that 0 <= k <= length(dest)
.
Returns Err(e)
if some underlying error occurs.
def readWhile(p: a -> Bool, bufReader: BufReader[a, t, r]): Result[IoError, Vector[a]] \ Aef[t] + r with Readable[t] where Readable.Elm[t] ~ a
SourceReads from reader
until an element is reached that does not satisfy predicate p
.
Returns Ok(vec)
where vec
is a vector of the first k
elements where k
is the index of the first element that does not satisfy p
.
This element is not included in the vector, and will be read on the next read.
All elements of vec
are guaranteed to satisfy p
.
Returns Err(err)
if there is an IO error.
def skip(n: Int32, bufReader: BufReader[a, t, r]): Result[IoError, Int32] \ Aef[t] + r with Readable[t] where Readable.Elm[t] ~ a
SourceAdvances the reader by n
, skipping over the elements without reading them.
Returns Ok(k)
where k
is the number of items skipped.
Guarantees that 0 <= k <= max(n, 0)
. If k < n
, then EOF has been reached.
Returns Err(err)
if there is an IO error.