equal
deleted
inserted
replaced
53 |
53 |
54 self obsoleteMethodWarning:'WARNING: with: should not be used for ReadStreams - use #on:'. |
54 self obsoleteMethodWarning:'WARNING: with: should not be used for ReadStreams - use #on:'. |
55 ^ super with:aCollection |
55 ^ super with:aCollection |
56 ! ! |
56 ! ! |
57 |
57 |
58 |
|
59 !ReadStream methodsFor:'converting'! |
58 !ReadStream methodsFor:'converting'! |
60 |
59 |
61 readStream |
60 readStream |
62 "return a readStream from the receiver. Since this is already |
61 "return a readStream from the receiver. Since this is already |
63 a readStream, return self." |
62 a readStream, return self." |
193 %}. |
192 %}. |
194 ((position + 1 - ZeroPosition) > readLimit) ifTrue:[^ self pastEndRead]. |
193 ((position + 1 - ZeroPosition) > readLimit) ifTrue:[^ self pastEndRead]. |
195 ret := collection at:(position + 1 - ZeroPosition). |
194 ret := collection at:(position + 1 - ZeroPosition). |
196 position := position + 1. |
195 position := position + 1. |
197 ^ ret |
196 ^ ret |
|
197 ! |
|
198 |
|
199 next:count |
|
200 "return the next count elements of the stream as aCollection, |
|
201 which depends on the streams type - (see #contentsSpecies)." |
|
202 |
|
203 |answer| |
|
204 |
|
205 self contentsSpecies = collection class ifTrue:[ |
|
206 ((position + count - ZeroPosition) > readLimit) ifFalse:[ |
|
207 answer := collection copyFrom:position+1 to:position+count. |
|
208 position := position+count. |
|
209 ^ answer |
|
210 ]. |
|
211 ]. |
|
212 ^ super next:count |
|
213 |
|
214 " |
|
215 #[1 2 3 4 5 6 7 8 9] readStream |
|
216 next; |
|
217 next:5; |
|
218 next. |
|
219 " |
198 ! |
220 ! |
199 |
221 |
200 nextAlphaNumericWord |
222 nextAlphaNumericWord |
201 "read the next word (i.e. up to non letter-or-digit). |
223 "read the next word (i.e. up to non letter-or-digit). |
202 return a string containing those characters. |
224 return a string containing those characters. |
804 ! ! |
826 ! ! |
805 |
827 |
806 !ReadStream class methodsFor:'documentation'! |
828 !ReadStream class methodsFor:'documentation'! |
807 |
829 |
808 version |
830 version |
809 ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.62 2007-06-05 16:20:22 stefan Exp $' |
831 ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.63 2009-10-08 08:43:59 cg Exp $' |
|
832 ! |
|
833 |
|
834 version_CVS |
|
835 ^ '$Header: /cvs/stx/stx/libbasic/ReadStream.st,v 1.63 2009-10-08 08:43:59 cg Exp $' |
810 ! ! |
836 ! ! |