Not yet rated

Problem

I would like to know how to use the compress and uncompress methods on the ByteArray class, what they are useful for and any drawbacks to using them.

Solution

Unless I am mis-understanding the problem, you use ByteArray's compress function to compress and uncompress to uncompress.

Detailed explanation

This is a fairly simple request to fullfil.  The ByteArray Class already provides you with ability to compress/uncompress.  It even provides two different compression algorithms: zlib & deflate.  So, if bytes is your ByteArray to compress using the zlib algorithm:

bytes.compress();

And to uncompress:

bytes.uncompress();

You could also  compress using the deflate algorithm:

bytes.deflate();

And to inflate:

bytes.inflate();

+
This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License. Permissions beyond the scope of this license, pertaining to the examples of code included within this work are available at Adobe.

Report abuse

Related recipes