Chris Muller uploaded a new version of Files to project The Trunk:
http://source.squeak.org/trunk/Files-cmm.144.mcz==================== Summary ====================
Name: Files-cmm.144
Author: cmm
Time: 29 April 2015, 8:53:59.602 pm
UUID: 308a68a6-d0f3-4fdb-a4ba-e8fe35fa6a99
Ancestors: Files-dtl.143
- Fix up asBytesDescription.
- Remove a redundant override.
=============== Diff against Files-dtl.143 ===============
Item was changed:
----- Method: Integer>>asBytesDescription (in category '*files') -----
asBytesDescription
"Answer a terse, easily-readable representation of this Integer as a number of bytes. Useful for file-browsers."
+ | sign abs suffixes units |
+ sign := self negative ifTrue: ['-'] ifFalse: [String empty].
+ abs := self abs.
+ suffixes := { '' "bytes". 'k'"ilobytes". 'M'"egabytes". 'G'"igabytes". 'T'"erabytes". 'P'"etabytes". 'E'"xabytes". 'Z'"ettabytes". 'Y'"ottabytes"}.
+ 1 to: suffixes size do:
+ [ : index |
- | suffixes |
- self isZero ifTrue: [ ^ '0' ].
- suffixes := { 'k'"ilobytes". 'M'"egabytes". 'G'"igabytes". 'T'"erabytes". 'P'"etabytes". 'E'"xabytes". 'Z'"ettabytes". 'Y'"ottabytes"}.
- suffixes size to: 1 by: -1 do:
- [ : index | | units rounded |
units := 1000 raisedTo: index.
+ units>abs ifTrue: [ ^ sign,(abs/(units/1000)) rounded asString,(suffixes at: index) ] ].
+ ^ sign,(abs/units) rounded,'Y'!
- rounded := ((self/units) rounded)*units.
- (rounded/self between: 0.95 and: 1.05) ifTrue: [ ^ ((self / units) rounded) asString, (suffixes at: index) ] ].
- ^ self asString!
Item was removed:
- ----- Method: StandardFileStream>>next:into:startingAt: (in category 'read, write, position') -----
- next: n into: aString startingAt: startIndex
- "Read n bytes into the given string.
- Return aString or a partial copy if less than
- n elements have been read."
-
- | count |
- count := self readInto: aString startingAt: startIndex count: n.
- count = n
- ifTrue:[ ^aString ]
- ifFalse:[ ^aString copyFrom: 1 to: startIndex + count - 1 ]!