Open
Description
(Split from #58)
Which tools exactly do you need to be able to read from stdin?
Many (Most? All? of the tools that can read textual data should already be able to read from stdin.
Many (Most? All?) of the tools that read binary data currently don't, because they need SeekableReadStream
s, and stdin obviously isn't seekable. However, often this is only used for SeekableReadStream::skip()
and only in a forward direction.
So I could probably fix that by:
- Introduce a companion method to
skip()
that seeks backwards. Though I'm not sure what to call it.rewind()
? Or ratherrewind()
isseek(0, kOriginBegin)
, whilerewind(size_t n)
isseek(-n, kOriginCurrent)
? - Change all uses of
skip()
with a negative parameter to use that new method - Change
SeekableReadStream::skip()
to take an unsigned value and mandate it to only skip forwards - Add a virtual method
skip
inReadStream
that implements it usingread()
.SeekableReadStream
still overrides it with theseek()
-using-implementation
That would give us a ReadStream
that can do skip()
and we might be able to downgrade some uses of SeekableReadStream
to ReadStream
instead, which means we can use StdInStream
there.
I would need to evaluate that on a case-by-case basis, though.
Thoughts?