[squeak-dev] Re: Generators on Streams on Generators on
Collections on ...
Bert Freudenberg
bert at freudenbergs.de
Tue Apr 12 20:19:02 UTC 2016
On 12.04.2016, at 21:33, marcel.taeumel <Marcel.Taeumel at hpi.de> wrote:
>
> Hi Nicolas,
>
> if you construct something like:
>
> | someStream |
> someStream := mySocketStream select: [:ea | ... ] thenCollect: [:ea | ... ].
> ...
> someStream next.
> ...
> someStream next: 5.
> ...
>
> You can only use someStream as long as there is data available while it is
> connected. Now, it can happen that socket streams are temporarily "at end"
> while no data is waiting in the buffer. Then, you would have to reconstruct
> someStream to continue. And know about it.
AFAIK, “at end” means there will not be any more data:
SocketStream>>atEnd
"There is nothing more to read when
there is no more data in our inBuffer, the socket
is disconnected and there is none available on the socket.
Note that we need to check isConnected before isDataAvailable,
otherwise data may sneak in in the meantime. But we check the
buffer first, because it is faster.”
self isInBufferEmpty ifFalse: [^false].
^self isConnected not
and: [self isDataAvailable not]
- Bert -
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 4207 bytes
Desc: not available
Url : http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20160412/b6e937ff/smime.bin
More information about the Squeak-dev
mailing list
|