eXept Software AG Logo

Smalltalk/X Webserver

Documentation of class 'ActorStream':

Home

Documentation
www.exept.de
Everywhere
for:
[back]

Class: ActorStream


Inheritance:

   Object
   |
   +--Stream
      |
      +--PeekableStream
         |
         +--ActorStream

Package:
stx:libbasic2
Category:
Streams
Version:
rev: 1.17 date: 2019/05/29 22:01:01
user: cg
file: ActorStream.st directory: libbasic2
module: stx stc-classLibrary: libbasic2
Author:
Claus Gittinger

Description:


This class provides a hook for general objects to behave like Stream objects.
To the outside, actorStreams behave like streams and respond to the
usual stream messages (i.e. nextPut:, nextPutAll: etc).
In the inside, for every nextPut-message, the nextPutBlock is evaluated
passing the argument of nextPut: as block argument.

These blocks are to be provided by the user of the ActorStream.
Example use is in the Transcript, which is made Stream-like this way.

[Instance variables:]
    nextPutBlock    <Block>   the block to evaluate for nextPut:-messages
    nextPutAllBlock <Block>   same for nextPutAll:-messages
    nextBlock       <Block>   the Block to evaluate for the next element


Related information:

    TextCollector

Class protocol:

instance creation
o  new
have to re-allow new - it was disabled in Stream


Instance protocol:

accessing
o  contentsSpecies
return a class of which instances will be returned, when
parts of the collection are asked for.
(see upTo-kind of methods in Stream)

o  contentsSpecies: something

accessing-read/write
o  next
return the next element from the stream by evaluating the nextBlock

o  nextPut: aCharacter
put something onto the stream by evaluating the nextPutBlock with
something as argument

o  nextPutAll: something
put all elements of something onto the stream by evaluating
the nextPutAllBlock with something as argument.
If there is no nextPutAllBlock, nextPuts will be used (as inherited)

o  nextPutAll: count from: buffer startingAt: start
put some elements of something onto the stream by evaluating
the nextPutAllBlock with something as argument.
If there is no nextPutAllBlock, nextPuts will be used (as inherited)

o  nextPutAll: something startingAt: start to: stop
put some elements of something onto the stream by evaluating
the nextPutAllBlock with something as argument.
If there is no nextPutAllBlock, nextPuts will be used (as inherited)

o  nextPutByte: something
put something onto the stream by evaluating the nextPutBlock with
something as argument

o  nextPutLine: something
put the line onto the stream by evaluating
the nextPutLineBlock with something as argument.
If there is no nextPutLineBlock, nextPutAll/nextPut will be used (as inherited)

o  peek
peek ahead for return the next element from the stream by evaluating the peekBlock

converting
o  readStream
return a readStream from the receiver.
Since this is (hopefully) already a readStream, return self.

defining actions
o  atEndBlock: aBlock
define the block to be evaluated for every atEnd-message

o  nextBlock: aBlock
define the block to be evaluated for every next-message

o  nextPutAllBlock: aBlock
define the block to be evaluated for every nextPutAll-message.
If undefined, nextPuts will be used (as inherited)

o  nextPutBlock: aBlock
define the block to be evaluated for every nextPut-message

o  nextPutLineBlock: aBlock
define the block to be evaluated for every nextPutLineBlock-message.
If undefined, nextPutAll/nextPut will be used (as inherited)

o  peekBlock: aBlock
define the block to be evaluated for every peek-message

queries
o  atEnd
return true, if at the end - actorStreams are never



ST/X 7.2.0.0; WebServer 1.670 at bd0aa1f87cdd.unknown:8081; Thu, 28 Mar 2024 12:33:25 GMT