|
Class: ActorStream
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
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
TextCollector
instance creation
-
new
-
have to re-allow new - it was disabled in Stream
accessing
-
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)
-
contentsSpecies: something
-
accessing-read/write
-
next
-
return the next element from the stream by evaluating the nextBlock
-
nextPut: aCharacter
-
put something onto the stream by evaluating the nextPutBlock with
something as argument
-
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)
-
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)
-
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)
-
nextPutByte: something
-
put something onto the stream by evaluating the nextPutBlock with
something as argument
-
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)
-
peek
-
peek ahead for return the next element from the stream by evaluating the peekBlock
converting
-
readStream
-
return a readStream from the receiver.
Since this is (hopefully) already a readStream, return self.
defining actions
-
atEndBlock: aBlock
-
define the block to be evaluated for every atEnd-message
-
nextBlock: aBlock
-
define the block to be evaluated for every next-message
-
nextPutAllBlock: aBlock
-
define the block to be evaluated for every nextPutAll-message.
If undefined, nextPuts will be used (as inherited)
-
nextPutBlock: aBlock
-
define the block to be evaluated for every nextPut-message
-
nextPutLineBlock: aBlock
-
define the block to be evaluated for every nextPutLineBlock-message.
If undefined, nextPutAll/nextPut will be used (as inherited)
-
peekBlock: aBlock
-
define the block to be evaluated for every peek-message
queries
-
atEnd
-
return true, if at the end - actorStreams are never
|