encode/decode the amf0/amf3 data