Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private function decompressToVec( data:String ):Vector.<uint>
- {
- // Raw ByteArray from data. Used to decode.
- var ba:ByteArray = Base64.decodeToByteArray( data ); // decoding
- ba.uncompress(); // decompressing
- ba = reverseBA( ba ); // reversing.
- return baToVector( ba ).reverse(); // to vector and reversing again.
- }
- private function baToVector( ba:ByteArray ):Vector.<uint>
- {
- var endVec:Vector.<uint> = new Vector.<uint>( ba.length / 4 );
- ba.position = 0;
- for ( var i:int = 0; i < ba.length / 4; i++ )
- {
- endVec[ i ] = ba.readUnsignedInt();
- }
- return endVec;
- }
- private function reverseBA( ba:ByteArray ):ByteArray
- {
- var endBA:ByteArray = new ByteArray();
- ba.position = ba.length;
- for ( var i:int = 0; i < ba.length; i++ )
- {
- ba.position--;
- endBA.writeByte( ba.readByte() );
- ba.position--;
- }
- return endBA;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement