amf read and write example