Book Image

haXe 2 Beginner's Guide

5 (1)
Book Image

haXe 2 Beginner's Guide

5 (1)

Overview of this book

Table of Contents (21 chapters)
haxe 2
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The haXe serializer


haXe has its own serializing system. This serializing system is the one used by haXe remoting therefore, before continuing with haXe remoting, it is important to understand how the haXe serializer works.

Usefulness

The haXe serializer is used by the haXe remoting system, but you can also use it on your own.

Doing so will allow you to get a string representation of almost any value. This way, you can, for example, store it on disk, in a database, or send it over any network connection.

Possibilities

The haXe serializer allows you to serialize almost any value, but still there are some things that you should know about how some values are serialized.

Basically, you should know that you can serialize:

  • Ints

  • Floats

  • Bools

  • Strings

  • nulls

  • haXe.io.Bytes

  • Arrays

  • List

  • Hash

  • Class instances

  • Enum instances

  • Anonymous objects

  • Exceptions

Now, let's see what you need to know about how these are serialized.

Class instances

When you serialize a class instance, all of its fields are serialized and it also stores...