Hi guys. I found that GZipWriteStream throws an error when closing it twice. Example:

| aStream zipStream |
aStream := ByteArray new writeStream binary.
zipStream := GZipWriteStream on: aStream.
zipStream close.
zipStream close.

All the streams I know do not throw an error in that case. And moreoever, it gets things complicated when using #on:do:. For example:

��� FileStream
��� ��� forceNewFileNamed: testFileName
��� ��� do: [ :stream |
��� ��� ��� GZipWriteStream
��� ��� ��� ��� on: stream binary
��� ��� ��� ��� do: [ :gzipStream |
��� ��� ��� ��� ��� FLSerializer newDefault serialize: anObject on: gzipStream ] ].

In thise case, FLSerializer closes the stream at the end. No matter whether Fuel should do that or not, the thing is that in this I have the mentioned problem.

So...my question is, is this a bug?� if it is, do you have a better idea that changing #close to this:

ZipWriteStream >> close
��� literals isNil ifTrue: [
��� ��� "#initialize sets this instVar to a specific value. #release puts it in nil, and #release is called from #flushBlock: which is called from #close:. Therefore, if it is nil, it means the stream has already been closed. If we try to close it twice, #flushBlock will throw an error because its instance variables are with nil"
��� ��� ^ self]
��� self deflateBlock.
��� self flushBlock: true.
��� encoder close.


--
Mariano
http://marianopeck.wordpress.com