Search code examples
smalltalkpharo

Compressing data in Smalltalk


I'm sending data (serialize objects) back and forth over TCP sockets. It gets passed as a ByteString, but and changed to a ByteArray when I use it. What can I use to compress the data before sending?

I've found some information about compressing files, but nothing on raw data. If anyone has ideas it would be appreciated.

Thanks!


Solution

  • There are two messages zipped and unzipped but only implemented in String.

    If you start with a ByteArray, then you can do

    someByteArray asString zipped.