CollectingReadStream.st
changeset 5247 abb5d984aafa
parent 4951 3485b5b540a0
equal deleted inserted replaced
5246:bfd51179c98a 5247:abb5d984aafa
     1 "{ Encoding: utf8 }"
       
     2 
       
     3 "
     1 "
     4  COPYRIGHT (c) 2009 by Claus Gittinger
     2  COPYRIGHT (c) 2009 by Claus Gittinger
     5               All Rights Reserved
     3               All Rights Reserved
     6 
     4 
     7  This software is furnished under a license and may be used
     5  This software is furnished under a license and may be used
    99             collecting:[:each | each squared].
    97             collecting:[:each | each squared].
   100      s upToEnd  
    98      s upToEnd  
   101     "
    99     "
   102 ! !
   100 ! !
   103 
   101 
       
   102 !CollectingReadStream methodsFor:'accessing'!
       
   103 
       
   104 readStream
       
   105     ^ self
       
   106 
       
   107     "Created: / 26-10-2011 / 17:25:43 / cg"
       
   108 ! !
       
   109 
   104 !CollectingReadStream methodsFor:'instance creation'!
   110 !CollectingReadStream methodsFor:'instance creation'!
   105 
   111 
   106 on:aStream collecting:aBlock
   112 on:aStream collecting:aBlock
   107     inStream := aStream.
   113     inStream := aStream.
   108     collectBlock := aBlock.
   114     collectBlock := aBlock.
       
   115 ! !
       
   116 
       
   117 !CollectingReadStream methodsFor:'obsolete positioning'!
       
   118 
       
   119 position0Based
       
   120     <resource: #obsolete>
       
   121     ^ inStream position
       
   122 
       
   123     "Created: / 26-10-2011 / 17:23:56 / cg"
       
   124 !
       
   125 
       
   126 position1Based
       
   127     <resource: #obsolete>
       
   128     ^ inStream position + 1
       
   129 
       
   130     "Created: / 26-10-2011 / 17:22:42 / cg"
   109 ! !
   131 ! !
   110 
   132 
   111 !CollectingReadStream methodsFor:'queries'!
   133 !CollectingReadStream methodsFor:'queries'!
   112 
   134 
   113 atEnd
   135 atEnd
   126      (see upTo-kind of methods in Stream)"
   148      (see upTo-kind of methods in Stream)"
   127 
   149 
   128     ^ inStream contentsSpecies.
   150     ^ inStream contentsSpecies.
   129 ! !
   151 ! !
   130 
   152 
   131 !CollectingReadStream methodsFor:'stream protocol'!
   153 !CollectingReadStream methodsFor:'reading'!
   132 
   154 
   133 next
   155 next
   134     inStream atEnd ifTrue:[
   156     inStream atEnd ifTrue:[
   135         ^ self pastEndRead
   157         ^ self pastEndRead
   136     ].
   158     ].
   164 
   186 
   165 peekOrNil
   187 peekOrNil
   166     ^ inStream peekOrNil
   188     ^ inStream peekOrNil
   167 
   189 
   168     "Created: / 26-10-2011 / 17:25:32 / cg"
   190     "Created: / 26-10-2011 / 17:25:32 / cg"
   169 !
   191 ! !
       
   192 
       
   193 !CollectingReadStream methodsFor:'stream protocol'!
   170 
   194 
   171 position
   195 position
   172     ^ inStream position
   196     ^ inStream position
   173 
   197 
   174     "Created: / 26-10-2011 / 17:25:08 / cg"
   198     "Created: / 26-10-2011 / 17:25:08 / cg"
   175 !
   199 !
   176 
   200 
   177 position0Based
       
   178     <resource: #obsolete>
       
   179     ^ inStream position
       
   180 
       
   181     "Created: / 26-10-2011 / 17:23:56 / cg"
       
   182 !
       
   183 
       
   184 position1Based
       
   185     <resource: #obsolete>
       
   186     ^ inStream position + 1
       
   187 
       
   188     "Created: / 26-10-2011 / 17:22:42 / cg"
       
   189 !
       
   190 
       
   191 position:newPos
   201 position:newPos
   192     inStream position:newPos
   202     inStream position:newPos
   193 
   203 
   194     "Created: / 26-05-2019 / 00:57:19 / Claus Gittinger"
   204     "Created: / 26-05-2019 / 00:57:19 / Claus Gittinger"
   195 !
       
   196 
       
   197 readStream
       
   198     ^ self
       
   199 
       
   200     "Created: / 26-10-2011 / 17:25:43 / cg"
       
   201 ! !
   205 ! !
   202 
   206 
   203 !CollectingReadStream class methodsFor:'documentation'!
   207 !CollectingReadStream class methodsFor:'documentation'!
   204 
   208 
   205 version_CVS
   209 version_CVS