--- a/CompressionStream.st Thu Aug 22 09:41:49 2002 +0200
+++ b/CompressionStream.st Thu Aug 22 09:51:15 2002 +0200
@@ -352,6 +352,13 @@
].
!
+contentsSpecies
+ "return the kind of object to be returned by sub-collection builders
+ "
+ binary == true ifTrue:[ ^ ByteArray ].
+ ^ String
+!
+
onStreamPutBytes:count from:data
"write compressed data to the (output) stream
"
@@ -426,19 +433,14 @@
"return the entire contents of the stream;
after reading the stream is closed.
"
- |stream bfsize buffer count|
+ |species stream bfsize buffer count|
mode == #readonly ifFalse:[ self errorReadOnly ].
bfsize := outputBytes size.
- binary ifTrue:[
- stream := ByteArray new:bfsize.
- buffer := ByteArray new:bfsize.
- ] ifFalse:[
- stream := String new:bfsize.
- buffer := String new:bfsize.
- ].
- stream := stream writeStream.
+ species := self contentsSpecies.
+ buffer := species new:bfsize.
+ stream := (species new:bfsize) writeStream.
[ self canReadWithoutBlocking ] whileTrue:[
count := self z_nextAvailableInto:buffer startingAt:1.