[squeak-dev] Re: Generators on Streams on Generators on
Collections on ...
David T. Lewis
lewis at mail.msen.com
Tue Apr 12 20:47:53 UTC 2016
FWIW, In OSProcess I used #upToEnd to mean "all of the data that is
currently available in the stream" and #upToEndOfFile to mean "all of that
data that will ever be available". Separately, the steam may be in
blocking or non-blocking mode, where blocking means that #upToEndOfFile
will block until EOF is detected.
Dave
> 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 -
>
>
>
More information about the Squeak-dev
mailing list
|