Stream Question

Ned Konz ned at bike-nomad.com
Wed Sep 19 15:50:08 UTC 2001


On Wednesday 19 September 2001 06:06 am, Ken G. Brown wrote:
> Ok, I see that I have to keep track of positions which I had at first
> assumed was being handled by the stream itself.
>
> How does one normally handle the case when writing to a stream
> approaches the end of allotted space, for example writing to a
> Transcript? I suppose if near the end you could reset but that may
> not have the desirable results. Is there some sort of first in first
> out stream available somewhere?

I made a CircularBuffer a while ago; don't remember if I posted it to the 
list. It's a fixed size queue. You could make a stream on it, I think (I'll 
try it). Its position keeps increasing, but it only retains the last N 
elements. And it doesn't generate a lot of garbage.

But Transcripts handle hitting their limit by just sending out the 
characters, emptying, and continuing (see TranscriptStream>>pastEndPut:).

And their views are told to only retain so many characters; when they get new 
input they chop their collections to only retain that many (by default, 20000 
characters).

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com




More information about the Squeak-dev mailing list