Prev | Current Page 868 | Next

L. McColl-Sylvester and F. Ponticelli

"Professional haXe and Neko"

The Serializer class has
one serialize() method that accepts an argument of type Dynamic that is the object or value to
serialize. Once an object has been serialized, the serialized string value can be obtained using the
toString() instance method. A shortcut to the whole process can be performed using the static
run() method that accepts a Dynamic value as an argument and returns it in the serialized form.
The Unserializer class does the contrary; an object in a serialized string form is passed as the
constructor argument and the unserialize() method rebuilds the object to its original form. The
unserialize() function is not aware of the type of object that it is going to process and returns a
generic Dynamic object; to use it properly you have to cast it to its original type. This class also has the
shortcut run() method that accepts an object in the serialized form as an argument and returns it
expanded to its original form.
Please note that the code that is delegated to unserialize the object must contain the definition of the
object type or an error is thrown.


Pages:
856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880