[Pkg] The Trunk: Compression-nice.32.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jun 2 13:15:27 UTC 2013


Nicolas Cellier uploaded a new version of Compression to project The Trunk:
http://source.squeak.org/trunk/Compression-nice.32.mcz

==================== Summary ====================

Name: Compression-nice.32
Author: nice
Time: 2 June 2013, 3:15:05.134 pm
UUID: bce2a55c-891e-4fee-bce4-d8a12461b792
Ancestors: Compression-ul.31

Add a utility #contentStreamFromEncoding: to decode some ZipArchiveMember with prescribed encoding ('latin1', 'utf8' etc...)

=============== Diff against Compression-ul.31 ===============

Item was changed:
  ----- Method: ZipArchiveMember>>contentStream (in category 'accessing') -----
  contentStream
  	"Answer my contents as a text stream.
  	Default is no conversion, since we don't know what the bytes mean."
  
+ 	^self contentStreamFromEncoding: 'latin1'
- 	| s |
- 	s := MultiByteBinaryOrTextStream on: (String new: self uncompressedSize).
- 	s converter: Latin1TextConverter new.
- 	self extractTo: s.
- 	s reset.
- 	^ s.
  !

Item was added:
+ ----- Method: ZipArchiveMember>>contentStreamFromEncoding: (in category 'accessing') -----
+ contentStreamFromEncoding: encodingName
+ 	"Answer my contents as a text stream.
+ 	Interpret the raw bytes with given encodingName"
+ 
+ 	| s |
+ 	s := MultiByteBinaryOrTextStream on: (String new: self uncompressedSize).
+ 	s converter:  (TextConverter newForEncoding: encodingName).
+ 	self extractTo: s.
+ 	s reset.
+ 	^ s
+ !



More information about the Packages mailing list