Open CLOVIS-AI opened 1 month ago
Do you mean the buffer of the Source
returned by peek()
? Or the original Source
that you are invoking peek()
on?
In either case, it seems covered by the documentation at the top of the Source
interface. Specifically:
...
* The buffer is refilled on reads as necessary, but it is also possible to ensure it contains enough data
* using [require] or [request].
* [Sink] also allows skipping unneeded prefix of data using [skip] and
* provides look ahead into incoming data, buffering as much as necessary, using [peek].
...
@CLOVIS-AI, yes, all the data accessed through the peek source will be available inside source's buffer. If there's not enough data in source's buffer to fulfill an operation on a peek source, new data will be fetched into the original source.
With a given source, if I run
source.peek().readInt()
, does this guarantee that 4 bytes will be read into the source's buffer?If so, this should be documented in
Source.peek()
.