File tree Expand file tree Collapse file tree 3 files changed +21
-0
lines changed
src/FS-AnsiStreams.package/TReadableStream.trait Expand file tree Collapse file tree 3 files changed +21
-0
lines changed Original file line number Diff line number Diff line change 1+ reading
2+ next: n into: aCollection startingAt: startIndex
3+ " Read n objects into the given collection.
4+ Return aCollection or a partial copy if less than n elements have been read."
5+
6+ | count |
7+ count := self readInto: aCollection startingAt: startIndex count: n.
8+ count = n
9+ ifTrue: [ ^ aCollection ]
10+ ifFalse: [ ^ aCollection copyFrom: 1 to: startIndex + count - 1 ]
Original file line number Diff line number Diff line change 1+ reading
2+ readInto: aCollection startingAt: startIndex count: n
3+ " Read n objects into the given collection.
4+ Return number of elements that have been read."
5+ | obj |
6+ 0 to: n - 1 do: [:i |
7+ obj := self next ifNil: [ ^ i ].
8+ aCollection at: startIndex + i put: obj].
9+ ^ n
Original file line number Diff line number Diff line change 44 "instance" : {
55 "collectionSpecies" : " jr 3/7/2017 16:49" ,
66 "do:" : " jr 6/7/2017 12:49" ,
7+ "next:into:startingAt:" : " jr 10/13/2018 23:09" ,
78 "nextLine" : " jr 6/7/2017 12:55" ,
89 "nextMatchFor:" : " jr 6/7/2017 12:57" ,
910 "peekFor:" : " jr 6/7/2017 13:05" ,
11+ "readInto:startingAt:count:" : " jr 10/13/2018 23:08" ,
1012 "skip:" : " jr 6/7/2017 13:09" ,
1113 "skipTo:" : " jr 6/7/2017 12:58" ,
1214 "upTo:" : " jr 6/7/2017 13:14" ,
You can’t perform that action at this time.
0 commit comments