On 29 Mar 2018, at 15:02, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2018-03-29 14:40 GMT+02:00 Sven Van Caekenberghe <sven@stfx.eu>:
On 29 Mar 2018, at 14:34, Denis Kudriashov <dionisiydk@gmail.com> wrote:
2018-03-29 11:45 GMT+02:00 Sven Van Caekenberghe <sven@stfx.eu>: ZnUtils class>>#streamFrom:to: ?
Yes, it gives feature which I want. But it's too Java style. What you think to move it to stream itself? And with what message name?
This was written in a specific context, to be efficient. I don't know if it is general enough for broad use. Yes it could be more OO to not make it a utility method, but on the other hand, where would you put it ?
In read streams we already have:
readInto: aCollection startingAt: startIndex count: n
So I would put new method in ReadStream (#readIntoStream: ?).
I am hesitant to make the Stream API bigger ;-)
We already have this method in Utils class. So it is here but in strange hidden place.
Not all streams inherit from ReadStream, far from it. So if you add it there, you add it to 'the stream API' that every other stream-like class has to implement. Hence it is a burden, for limited gain. I also do not specifically like Util classes, but this is a more special case. The operation belongs to both parties involved. You could define a StreamCopier to do the job. The way it is implemented now, it does not extend the stream API, that is worth something too. Anyway, we are just discussing ideas.
On 29 Mar 2018, at 11:22, Denis Kudriashov <dionisiydk@gmail.com> wrote:
Hi.
Do we have simple method to write data between streams?
I want something like:
writeStream nextPutAllFrom: readStream
I always used loop for this. But maybe we have something suitable. Otherwise lets introduce it.
Best regards, Denis