Copy link to clipboard
Copied
I would like to transfer compressed data with the ByteArray, I can add object to the ByteArray, compress them and get a compressed string of the data.
But I don't know how to revert the process, if I have the compress string of data, how can load it in a byte array decompress it and get the data?
var hw1:String="Hello World"; //My test data
var ba1:ByteArray = new ByteArray();
ba1.writeUTFBytes(hw1); //add test data to byte array
ba1.deflate(); //compress the byte array
var ser:String = ba1.toString(); //serialize the byte array to a compressed string
var ba2:ByteArray = new ByteArray();
ba2.writeUTFBytes(ser); //how to revert the serialized byte array in a byte array again?
ba2.inflate(); //decompress the byte array
var hw2:String=ba2.toString() //it should return my test data "Hello World"
Have something to add?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now