Unserializer implement of haxe.Unserializer
The Unserializer class can be used to decode values and objects from a String
created by the Serializer
class.
This class can be used in two ways :
- create a
new Unserializer()
instance with a given serializationString
, then call itsrun()
method until all values are extracted. - call
Unserializer.unserialize()
to unserialize a single value from a givenString
.
The specification of the serialization format can be found here.
List of supported formats
- JavaScript native type :
- Array
- Boolean
- Date
- Null
- Number (Zero, Integer, Float, Positive / Negative infinity, NaN)
- Object
- String
- Error (Exception).
- « haxe-type » type :
- List (haxe.ds.List)
- Bytes (haxe.io.Bytes)
- IntMap (haxe.ds.IntMap)
- StringMap (haxe.ds.StringMap)
- Enum (experimental)
- Class (experimental)
List of unsupported formats
- ObjectMap (haxe.ds.ObjectMap)
- custom
Note
If you are looking for how to use it, you can look at some examples in the unit tests.
new Unserializer(data: String, {
DEBUG_MODE: Bool = false,
ENUM_RESOLVER: Object = {},
CLASS_RESOLVER: Object = {}
})
public i: Int
public buffer: String
// buffer length
public length: Int
public StringCache: Array<String>
public ObjectCache: Array<Mixed>
public DEBUG_MODE: Bool
public ENUM_RESOLVER: Object
public CLASS_RESOLVER: Object
static unserialize
// return the unserialized buffer
public run(): Mixed
// internal function, a description soon
public readCache(cache: Array): Mixed
// internal function, a description soon
public readArrayScheme(type: String, end: String): Array
// internal function, a description soon
public readNumberScheme(type: String): Int|Float
// internal function, a description soon
public readObjectScheme(type: String, end: String): Object
// internal function, a description soon
public readStringScheme(type: String): String
// internal function, a description soon
public readEnum(type: String): Enum
// internal function, a description soon
public resolveClass(name: String, values: Object): Class