haXe API Documentation
Back | Index
class haxe.Unserializer
Available in flash8, neko, js, flash, php, cpp

The Unserializer class is the complement to the Serializer class. It parses a serialization String and creates objects from the contained data.

This class can be used in two ways: - create a new Unserializer() instance with a given serialization String, then call its unserialize() method until all values are extracted - call Unserializer.run() to unserialize a single value from a given String

function new(buf : String) : Void

Creates a new Unserializer instance, with its internal buffer initialized to buf.

This does not parse buf immediately. It is parsed only when calls to this.unserialize are made.

Each Unserializer instance maintains its own cache.

function getResolver() : TypeResolver
function setResolver(r : TypeResolver) : Void
function unserialize() : Dynamic
static var DEFAULT_RESOLVER : TypeResolver

This value can be set to use custom type resolvers.

A type resolver finds a Class or Enum instance from a given String. By default, the haxe Type Api is used.

A type resolver must provide two methods: resolveClass(name:String):Class is called to determine a Class from a class name resolveEnum(name:String):Enum is called to determine an Enum from an enum name

This value is applied when a new Unserializer instance is created. Changing it afterwards has no effect on previously created instances.

static function run(v : String) : Dynamic
Back | Index