PositionableStream.st
changeset 9284 6afd161ee43c
parent 9283 6bbfb248f483
child 9434 8700cca5c249
equal deleted inserted replaced
9283:6bbfb248f483 9284:6afd161ee43c
   145 
   145 
   146 !PositionableStream methodsFor:'Compatibility-Dolphin'!
   146 !PositionableStream methodsFor:'Compatibility-Dolphin'!
   147 
   147 
   148 endChunk
   148 endChunk
   149     self nextPutChunkSeparator
   149     self nextPutChunkSeparator
       
   150 ! !
       
   151 
       
   152 !PositionableStream methodsFor:'Compatibility-ST/V'!
       
   153 
       
   154 skipTo:anElement
       
   155     "ST/V compatibility:
       
   156      skip for the element given by the argument, anElement;
       
   157      return nil if not found, self otherwise. 
       
   158      On a successful match, the next read will return the element after anElement."
       
   159 
       
   160     ^ self skipThrough:anElement
       
   161 
       
   162     "
       
   163      |s|
       
   164      s := ReadStream on:'12345678901234567890'.
       
   165      s skipTo:$5.
       
   166      s copyFrom:1 to:(s position).    
       
   167      s upToEnd      
       
   168     "
   150 ! !
   169 ! !
   151 
   170 
   152 !PositionableStream methodsFor:'accessing'!
   171 !PositionableStream methodsFor:'accessing'!
   153 
   172 
   154 collection
   173 collection
   405      s atEnd  
   424      s atEnd  
   406     "
   425     "
   407 
   426 
   408     "Created: 26.6.1996 / 09:35:35 / cg"
   427     "Created: 26.6.1996 / 09:35:35 / cg"
   409     "Modified: 11.1.1997 / 19:16:38 / cg"
   428     "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     "
       
   431 !
   429 !
   432 
   430 
   433 skipToAll:aCollection
   431 skipToAll:aCollection
   434     "skip for the sequence given by the argument, aCollection;
   432     "skip for the sequence given by the argument, aCollection;
   435      return nil if not found, self otherwise. 
   433      return nil if not found, self otherwise. 
   618 ! !
   616 ! !
   619 
   617 
   620 !PositionableStream class methodsFor:'documentation'!
   618 !PositionableStream class methodsFor:'documentation'!
   621 
   619 
   622 version
   620 version
   623     ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.145 2006-03-15 10:35:21 cg Exp $'
   621     ^ '$Header: /cvs/stx/stx/libbasic/PositionableStream.st,v 1.146 2006-03-15 10:37:12 cg Exp $'
   624 ! !
   622 ! !
   625 
   623 
   626 PositionableStream initialize!
   624 PositionableStream initialize!