Nicolas Cellier uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-nice.31.mcz==================== Summary ====================
Name: Files-nice.31
Author: nice
Time: 22 November 2009, 6:30:23 am
UUID: 04962f5c-a25d-4105-82fa-959c5fe76c69
Ancestors: Files-cwp.30
1) correct #nextLine and #upToAnyOf: using a new message #collectionSpecies
2) correct #insertLineFeeds (unused) to work whatever the line end conventions
=============== Diff against Files-cwp.30 ===============
Item was changed:
----- Method: FileStream>>next: (in category 'accessing') -----
next: anInteger
| newCollection howManyRead increment |
+ newCollection := self collectionSpecies new: anInteger.
- newCollection := collection species new: anInteger.
howManyRead := 0.
[howManyRead < anInteger] whileTrue:
[self atEnd ifTrue:
[(howManyRead + 1) to: anInteger do: [:i | newCollection at: i put: (self next)].
^newCollection].
increment := (readLimit - position) min: (anInteger - howManyRead).
newCollection replaceFrom: (howManyRead + 1)
to: (howManyRead := howManyRead + increment)
with: collection
startingAt: (position + 1).
position := position + increment].
^newCollection!
Item was changed:
----- Method: StandardFileStream>>insertLineFeeds (in category 'properties-setting') -----
insertLineFeeds
"(FileStream oldFileNamed: 'BBfix2.st') insertLineFeeds"
| s crLf f |
+ crLf := String crlf.
+ s := self next: self size.
- crLf := String with: Character cr with: (Character value: 10).
- s := ReadStream on: (self next: self size).
self close.
f := FileStream newFileNamed: self name.
+ s linesDo: [:line | f nextPutAll: line; nextPutAll: crLf].
- [s atEnd] whileFalse:
- [f nextPutAll: (s upTo: Character cr); nextPutAll: crLf].
f close!
Item was added:
+ ----- Method: StandardFileStream>>collectionSpecies (in category 'private') -----
+ collectionSpecies
+ "Answer the species of collection into which the receiver can stream"
+
+ ^buffer1 species!