1 Introduction
1.1 Purpose
Action Message Format (AMF) is a compact binary format that is used to serialize
ActionScript object graphs. Once serialized an AMF encoded object graph may be used
to persist and retrieve the public state of an application across sessions or allow two
endpoints to communicate through the exchange of strongly typed data. The first version
of AMF, referred to as AMF 0, supports sending complex objects by reference which
helps to avoid sending redundant instances in an object graph. It also allows endpoints to
restore object relationships and support circular references while avoiding problems such
as infinite recursion during serialization. A new version of AMF, referred to as AMF 3 to
coincide with the release of ActionScript 3.0, improves on AMF 0 by sending object
traits and strings by reference in addition to object instances. AMF 3 also supports some
new data types introduced in ActionScript 3.0.
动作消息格式(AMF)采用二进制格式,用它来序列化ActionScript对象图。一经序
列化,AMF编码对象图可以用来持久化和检索跨会话应用程序的公开状态,或者
允许二个端点通过强类型交换进行通讯。AMF第一版为AMF0,通过引用支持发
送复杂对象,避免发送对象图的冗余实例。还允许端点恢复对象关系和在避免诸
如序列化期间无限递归等问题情况下支持循环引用。新版本AMF3为了与
ActionScript3.0发行版保持一致,在AMF0上进行了改进,使能发送对象属性和引
用字符串以及对象实例。AMF3还支持ActionScript3.0引入的一些新的数据类型。
1.2 Notational Conventions
1.2.1 Augmented BNF
Type definitions in this specification use Augmented Backus-Naur Form (ABNF) syntax
[RFC2234]. The reader should be familiar with this notation before reading this document.
本规范类型定义用ABNF语法[RFC2234].读者在读这个文档之前应当熟悉这个表示法
1.3 Basic Rules
Throughout this document bytes are assumed to be octets, or 8-bits.
U8
U16
= An unsigned byte (8-bits, an octet)
= An unsigned 16-bit integer in big endian
U32
(network) byte order
= An unsigned 32-bit integer in big endian (network)
byte order
Adobe Systems Incorporatated
AMF 3 Specification(January 2013)
所谓big endian
也就是数据类型为多字节的数据字节高位部分放在内存的低地址,低位部分放在内存地址
的高地址。network byte order(网络字节序)采用big endian。