I need something similar to what Guzzle calls a "PumpStream". I doubt mine needs to be quite so robust, but basically it just needs to do this:
read - when read is requested, it looks in the buffer (which is a BufferStream object), and if that is empty, it calls the user-specified function and fills the buffer with its return value. on the next read it reads from buffer until empty and repeats the process.
A few ideas for names:
BalloonStream
DeflateStream/InflateStream
DilateStream
RespireStream
I actually went with IteratorStream for what I needed this for, but it wouldn't hurt to still create a RespireStream... maybe...
I need something similar to what Guzzle calls a "PumpStream". I doubt mine needs to be quite so robust, but basically it just needs to do this:
read - when read is requested, it looks in the buffer (which is a BufferStream object), and if that is empty, it calls the user-specified function and fills the buffer with its return value. on the next read it reads from buffer until empty and repeats the process.
A few ideas for names:
I actually went with IteratorStream for what I needed this for, but it wouldn't hurt to still create a RespireStream... maybe...