Lukas Renggli wrote:
- The current Squeak Stream implementation lacks the possibility (and
it is difficult to do so in a clean way) to wrap streams with other streams.
Actually, some streams in Squeak (notably the zip streams) do have that ability. Try this for example:
file := FileStream newFileNamed: 'compressed.gz'. encoder := GZipWriteStream on: file. encoder nextPutAll: 'Hello World'. encoder close. "also closes file"
file := FileStream readOnlyFileNamed: 'compressed.gz'. decoder := GZipReadStream on: file. Transcript cr; show: decoder contents. decoder close. "also closes file"
As for whether it wouldn't be possible to generalize this cleanly in an EncoderStream and a DecoderStream (or a generalized TranscoderStream if you like) I'll leave that to the reader. Just keep in mind that if all you can think of is using a hammer everything starts looking a *lot* like a nail...
Cheers, - Andreas