PositionableStream.st
changeset 9283 6bbfb248f483
parent 9006 e5509951529d
child 9284 6afd161ee43c
--- a/PositionableStream.st	Wed Mar 15 11:33:32 2006 +0100
+++ b/PositionableStream.st	Wed Mar 15 11:35:21 2006 +0100
@@ -409,6 +409,27 @@
     "Modified: 11.1.1997 / 19:16:38 / cg"
 !
 
+skipTo:anElement
+    "skip for the element given by the argument, anElement;
+     return nil if not found, self otherwise. 
+     On a successful match, the next read will return the element after anElement."
+
+    |buffer len first idx|
+
+    [self atEnd] whileFalse:[
+        self next == anElement ifTrue:[^ self ].
+    ].
+    ^ nil
+
+    "
+     |s|
+     s := ReadStream on:'12345678901234567890'.
+     s skipTo:$5.
+     s copyFrom:1 to:(s position).    
+     s upToEnd      
+    "
+!
+
 skipToAll:aCollection
     "skip for the sequence given by the argument, aCollection;
      return nil if not found, self otherwise. 
@@ -599,7 +620,7 @@
 !PositionableStream class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.144 2005-12-05 00:30:22 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.145 2006-03-15 10:35:21 cg Exp $'
 ! !
 
 PositionableStream initialize!