classafPickle::Pickle

sys::Obj
  afPickle::Pickle

@Js

Pickles Fantom objects to and from strings.

readObj

Source

const static Obj? readObj(Str str, [Str:Obj]? options := null)

Read a pickled object from a string according to the Fantom serialization format.

Options may contain:

  • "makeArgs" - Obj[] - args to pass to the root object's ctor. Default is null.
  • "makeObjFn" - |Type type, Field:Obj? fieldVals->Obj?| - object creation func. Default is null.

See docs for a full explanation of all options.

readObjFromIn

Source

const static Obj? readObjFromIn(InStream in, [Str:Obj]? options := null)

A stream version of readObj().

writeObj

Source

const static Str writeObj(Obj? obj, [Str:Obj]? options := null)

Pickles an object to a string according to the Fantom serialization format.

The options may be used to specify the format of the output:

  • "indent" - Int or Str - num of spaces to indent, or the actual indent. Default is "\t".
  • "skipDefaults" - Bool - skip fields with default values. Default is false.
  • "skipErrors" - Bool - skip objects which aren't serializable. Default is false.
  • "usings" - Str[] - List of pod names to emit in using statements, ["usings":["sys", "afPickle"]] Default is null.

See docs for a full explanation of all options.

writeObjToOut

Source

const static Void writeObjToOut(OutStream out, Obj? obj, [Str:Obj]? options := null)

A stream version of writeObj().