--- a/WriteStream.st Tue Jul 10 12:02:29 2001 +0200
+++ b/WriteStream.st Tue Jul 10 12:06:56 2001 +0200
@@ -124,6 +124,46 @@
"Modified: / 30.10.1997 / 16:21:23 / cg"
!
+last
+ "return the last element - report an error if the stream is empty"
+
+ ^ collection at:(position - 1).
+
+ "
+ |s|
+
+ s := '' writeStream.
+ s nextPut:$a.
+ s last.
+ s nextPut:$b.
+ s last.
+ s nextPut:$c.
+ s last.
+ "
+!
+
+last:n
+ "return the last n elements as species of the underlying collection;
+ Report an error if the stream is empty"
+
+ ^ collection copyFrom:(position - n) to:(position - 1).
+
+ "
+ |s|
+
+ s := '' writeStream.
+ s nextPut:$a.
+ s last:1.
+ s nextPut:$b.
+ s last:1.
+ s last:2.
+ s nextPut:$c.
+ s last:1.
+ s last:2.
+ s last:3.
+ "
+!
+
reset
"reset the stream; write anew.
See the comment in WriteStream>>contents"
@@ -437,5 +477,5 @@
!WriteStream class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.44 2000-08-22 13:49:36 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/WriteStream.st,v 1.45 2001-07-10 10:06:56 cg Exp $'
! !