Andreas Raab uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ar.377.mcz==================== Summary ====================
Name: Collections-ar.377
Author: ar
Time: 1 September 2010, 11:31:12.782 pm
UUID: d93b436b-d8ab-d545-bbf1-ef78a2d76915
Ancestors: Collections-ar.376
Break the dependency between the Collection and the Compression package.
=============== Diff against Collections-ar.376 ===============
Item was removed:
- ----- Method: ReadWriteStream>>asUnZippedStream (in category 'converting') -----
- asUnZippedStream
- | isGZip outputStream first strm archive which |
- "Decompress this file if needed, and return a stream. No file is written. File extension may be .gz or anything else. Also works on archives (.zip, .gZip)."
-
- strm := self binary.
- strm isZipArchive ifTrue: [
- archive := ZipArchive new readFrom: strm.
- which := archive members detect: [:any | any fileName asLowercase endsWith: '.ttf']
- ifNone: [nil].
- which ifNil: [archive close.
- ^ self error: 'Can''t find .ttf file in archive'].
- strm := which contentStream.
- archive close].
-
- first := strm next.
- isGZip := (strm next * 256 + first) = (GZipConstants gzipMagic).
- strm skip: -2.
- isGZip
- ifTrue: [outputStream := (MultiByteBinaryOrTextStream with:
- (GZipReadStream on: strm) upToEnd) reset.
- strm close]
- ifFalse: [outputStream := strm].
- ^ outputStream!
Item was removed:
- ----- Method: PositionableStream>>asZLibReadStream (in category 'converting') -----
- asZLibReadStream
- ^ZLibReadStream on: collection from: position+1 to: readLimit!
Item was removed:
- ----- Method: String>>unzipped (in category 'converting') -----
- unzipped
- | magic1 magic2 |
- magic1 := (self at: 1) asInteger.
- magic2 := (self at: 2) asInteger.
- (magic1 = 16r1F and:[magic2 = 16r8B]) ifFalse:[^self].
- ^(GZipReadStream on: self) upToEnd!
Item was removed:
- ----- Method: String>>zipped (in category 'converting') -----
- zipped
- | stream gzstream |
-
- stream := RWBinaryOrTextStream on: String new.
-
- gzstream := GZipWriteStream on: stream.
- gzstream nextPutAll: self.
- gzstream close.
- stream reset.
-
- ^ stream contents.
- !
Item was removed:
- ----- Method: ReadWriteStream>>isZipArchive (in category 'testing') -----
- isZipArchive
- "Determine if this appears to be a valid Zip archive"
- | sig |
- self binary.
- sig := self next: 4.
- self position: self position - 4. "rewind"
- ^ZipArchive validSignatures includes: sig!