PositionableStream.st
changeset 9283 6bbfb248f483
parent 9006 e5509951529d
child 9284 6afd161ee43c
equal deleted inserted replaced
9282:f6d9d4129919 9283:6bbfb248f483
   405      s atEnd  
   405      s atEnd  
   406     "
   406     "
   407 
   407 
   408     "Created: 26.6.1996 / 09:35:35 / cg"
   408     "Created: 26.6.1996 / 09:35:35 / cg"
   409     "Modified: 11.1.1997 / 19:16:38 / cg"
   409     "Modified: 11.1.1997 / 19:16:38 / cg"
       
   410 !
       
   411 
       
   412 skipTo:anElement
       
   413     "skip for the element given by the argument, anElement;
       
   414      return nil if not found, self otherwise. 
       
   415      On a successful match, the next read will return the element after anElement."
       
   416 
       
   417     |buffer len first idx|
       
   418 
       
   419     [self atEnd] whileFalse:[
       
   420         self next == anElement ifTrue:[^ self ].
       
   421     ].
       
   422     ^ nil
       
   423 
       
   424     "
       
   425      |s|
       
   426      s := ReadStream on:'12345678901234567890'.
       
   427      s skipTo:$5.
       
   428      s copyFrom:1 to:(s position).    
       
   429      s upToEnd      
       
   430     "
   410 !
   431 !
   411 
   432 
   412 skipToAll:aCollection
   433 skipToAll:aCollection
   413     "skip for the sequence given by the argument, aCollection;
   434     "skip for the sequence given by the argument, aCollection;
   414      return nil if not found, self otherwise. 
   435      return nil if not found, self otherwise. 
   597 ! !
   618 ! !
   598 
   619 
   599 !PositionableStream class methodsFor:'documentation'!
   620 !PositionableStream class methodsFor:'documentation'!
   600 
   621 
   601 version
   622 version
   602     ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.144 2005-12-05 00:30:22 stefan Exp $'
   623     ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.145 2006-03-15 10:35:21 cg Exp $'
   603 ! !
   624 ! !
   604 
   625 
   605 PositionableStream initialize!
   626 PositionableStream initialize!