Stream Question

Ken G. Brown kbrown at tnc.com
Wed Sep 19 17:02:51 UTC 2001


I am reading continuous input from a serial port, displaying on several
transcripts depending on embedded tokens. By the way everyone, Thx to all
the help I have the first try at this stuff working now!

I have a process monitoring the port, writing to a stream, and via
WorldState addDeferredMessage: I'm splitting the stream and displaying to
multiple TranscriptsStream windows. For now I've saved the write position,
restored the previous saved read position for the current output, then on
exit restored the write position again. I need to be able to run for days so
do not want streams doubling their size when they reach the end. Ned's
circular buffer sounds like what I need to do. I also will look into the
possibility of creating a second read stream on the first write stream, that
sounds like it would be helpful. Did not know you could do that.

Thx
Ken

> -----Original Message-----
> From: squeak-dev-admin at lists.squeakfoundation.org
> [mailto:squeak-dev-admin at lists.squeakfoundation.org]On Behalf Of Bijan
> Parsia
> Sent: September 19, 2001 9:38 AM
> To: squeak-dev at lists.squeakfoundation.org
> Subject: Re: Stream Question
>
>
> On Wed, 19 Sep 2001, 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.
>
> It was. You wrote to the stream and changed the position. You
> read from
> that position. What did you want to have happen?
>
> > How does one normally handle the case when writing to a stream
> > approaches the end of allotted space, for example writing to a
> > Transcript?
>
> "Allotted space"? Do you mean the size of the Collection
> initially fed to
> the stream? The stream will expand it as necessary (usually
> by doubling).
>
> Otherwise, I'm not sure what you mean.
>
> Note that you can have muliple streams on the same collection.
>
> > I suppose if near the end you could reset but that may
> > not have the desirable results.
>
> Try:
>
> 	(((WriteStream on: '') nextPutAll: 'willExpand')
> 			       nextPutAll: ' a
> lot') contents
>
> > Is there some sort of first in first
> > out stream available somewhere?
>
> You need to explain your needs a bit better for me. I don't understand
> what you're trying to do.
>
> Cheers,
> Bijan Parsia.
>
>





More information about the Squeak-dev mailing list