Nicolas Cellier uploaded a new version of Collections to project The Trunk: http://source.squeak.org/trunk/Collections-nice.503.mcz
==================== Summary ====================
Name: Collections-nice.503 Author: nice Time: 3 March 2013, 2:36:21.966 pm UUID: 180c7283-9170-4fd8-9893-16122ba48f56 Ancestors: Collections-bf.502
Get rid from two un-necessary usages of ReadStream on:from:to:
=============== Diff against Collections-bf.502 ===============
Item was changed: ----- Method: PositionableStream>>decodeString:andRuns: (in category 'fileIn/Out') ----- decodeString: string andRuns: runsRaw
| strm runLength runValues newString index | + strm := runsRaw readStream. - strm := ReadStream on: runsRaw from: 1 to: runsRaw size. (strm peekFor: $( ) ifFalse: [^ nil]. runLength := OrderedCollection new. [strm skipSeparators. strm peekFor: $)] whileFalse: [runLength add: (Number readFrom: strm)].
runValues := OrderedCollection new. [strm atEnd not] whileTrue: [runValues add: (Number readFrom: strm). strm next.].
newString := WideString new: string size. index := 1. runLength with: runValues do: [:length :leadingChar | index to: index + length - 1 do: [:pos | newString at: pos put: (Character leadingChar: leadingChar code: (string at: pos) charCode). ]. index := index + length. ].
^ newString. !
Item was changed: ----- Method: PositionableStream>>nextChunkText (in category 'fileIn/Out') ----- nextChunkText "Deliver the next chunk as a Text. Decode the following ]style[ chunk if present. Position at start of next real chunk." + | string runs peek pos | - | string runsRaw strm runs peek pos | "Read the plain text" string := self nextChunk. "Test for ]style[ tag" pos := self position. peek := self skipSeparatorsAndPeekNext. peek = $] ifFalse: [self position: pos. ^ string asText]. "no tag" (self upTo: $[) = ']style' ifFalse: [self position: pos. ^ string asText]. "different tag"
"Read and decode the style chunk" + runs := RunArray scanFrom: self basicNextChunk readStream. - runsRaw := self basicNextChunk. "style encoding" - strm := ReadStream on: runsRaw from: 1 to: runsRaw size. - runs := RunArray scanFrom: strm.
^ Text basicNew setString: string setRunsChecking: runs. !
packages@lists.squeakfoundation.org