Why is zipped using a RWBinaryOrTextStream rather than just a WriteStream?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Why is zipped using a RWBinaryOrTextStream rather than just a WriteStream?

Nicolas Cellier
this code

    | stream gzstream |
    stream := RWBinaryOrTextStream on: ByteArray new.
    gzstream := GZipWriteStream on: stream.
    gzstream nextPutAll: #[1 2 3 4].
    gzstream close.
    stream reset.
    ^ stream contents.

versus

    | stream gzstream |
    stream := ByteArray new writeStream.
    gzstream := GZipWriteStream on: stream.
    gzstream nextPutAll: #[1 2 3 4].
    gzstream close.
    ^ stream contents.

Because we love complexity so much?