as3-msgpack is an implementation of MessagePack specification. MessagePack is an efficient binary serialization format, allowing applications to exchange data among multiple languages like JSON, but using a much faster and smaller representation. Small integers (like flags or error code), for instance, are encoded into a single byte.
Message pack specification was built to work mostly with primitive types. msgpack is similiar to JSON, but is based on binary data instead of text. The types available are: signed/unsigned integer, single/double precision floating point, nil (null), boolean, array, associative array (map) and raw buffer. These types are mapped to Actionscript3 as the following:
- signed integer -> int
- unsigned integer -> uint
- single/double precision floating point -> Number
- nil -> null
- boolean -> Boolean
- array -> Array
- associative array -> Object
- raw buffer -> String or ByteArray
Sample
// message pack object created var msgpack:MsgPack = new MsgPack(); // encode an array var bytes:ByteArray = msgpack.write([1, 2, 3, 4, 5]); // rewind the buffer bytes.position = 0; // print the decoded object trace(msgpack.read(bytes));
OMG @as3gamegears have a lot of ANE for iOS! Love it =]
Huyhung Kun liked this on Facebook.
RT @as3gamegears: New: as3-msgpack (implementation of MessagePack specification in #as3) http://t.co/TAtju5DX2K #flash #gamedev via @Flash…
Flash Daily liked this on Facebook.
Jakub Wagner liked this on Facebook.