--- a/ActorStream.st Thu Mar 30 19:08:39 2006 +0200
+++ b/ActorStream.st Thu Mar 30 19:08:53 2006 +0200
@@ -12,9 +12,9 @@
"{ Package: 'stx:libbasic2' }"
-Stream subclass:#ActorStream
+PeekableStream subclass:#ActorStream
instanceVariableNames:'nextPutBlock nextPutAllBlock nextPutLineBlock nextBlock
- atEndBlock'
+ atEndBlock peekBlock'
classVariableNames:''
poolDictionaries:''
category:'Streams'
@@ -125,6 +125,24 @@
^ nextPutLineBlock value:something
].
super nextPutLine:something
+!
+
+peek
+ "peek ahead for return the next element from the stream by evaluating the peekBlock"
+
+ peekBlock notNil ifTrue:[
+ ^ peekBlock value
+ ].
+ self error:'action for peek is undefined'
+! !
+
+!ActorStream methodsFor:'converting'!
+
+readStream
+ "return a readStream from the receiver.
+ Since this is (hopefully) already a readStream, return self."
+
+ ^ self
! !
!ActorStream methodsFor:'defining actions'!
@@ -159,6 +177,12 @@
If undefined, nextPutAll/nextPut will be used (as inherited)"
nextPutLineBlock := aBlock
+!
+
+peekBlock:aBlock
+ "define the block to be evaluated for every peek-message"
+
+ peekBlock := aBlock
! !
!ActorStream methodsFor:'queries'!
@@ -175,5 +199,5 @@
!ActorStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic2/ActorStream.st,v 1.9 2002-01-28 19:59:44 mb Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic2/ActorStream.st,v 1.10 2006-03-30 17:08:53 cg Exp $'
! !