[squeak-dev] Re: Generators on Streams on Generators on
Collections on ...
Chris
cunningham.cb at gmail.com
Wed Apr 13 23:30:58 UTC 2016
Sent from my iPhone
> On Apr 13, 2016, at 4:20 PM, Ben Coman <btc at openinworld.com> wrote:
>
>> On Wed, Apr 13, 2016 at 9:42 PM, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>>
>>
>>> On Apr 12, 2016, at 1:47 PM, David T. Lewis <lewis at mail.msen.com> wrote:
>>>
>>> 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.
>>
>> You could use e.g. upToAvailable and upToEnd.
>
> upToBufferEnd ?
>
allAvailable ?
> cheers -ben
>
>>
>>>
>>> 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
|