AMF3协议中文版

翻译:许江华
Adobe Systems Inc.
AMF3Specification
Category:ActionScript Serialization类别:AS序列化
Action Message Format--AMF3
Copyright Notice
静电纺丝纳米纤维膜
Copyright(c)Adobe Systems Inc.(2002-2006).All Rights Reserved.
Abstract概览
Action Message Format(AMF)is a compact binary format that is used to serialize ActionScr ipt 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.
AMF(Act ion Message Format动作信息格式)是用来序列化AS(ActionScr ipt动作脚本)实例对象(object graphs)的压缩的二进制格式。序列化的AMF编码的实例对象可用来持久化,并且在不同的会话中获得应用的公共状态,或者允许在两个端点(比如客户端和服务器端--译者注)通过强类型数据交换进行通信。
AMF was introduced in Flash Player6in2001and remained unchanged with the introduction of ActionScr ipt2.0in Flash Player7and with the release of Flash Player8.This version of AMF is referred to as AMF0(See[AMF0]).In Flash Player9,Action Script3.0was introduced along with a new ActionScr ipt Virtual Machine(AVM+)-the new data types and language features made possible by these improvements prompted AMF to be updated.Given the opportunity to release a new version of AMF,several opt imiza tions were also made to the encoding format to remove redundant information from serialized data.This specif ication defines this updated version of AMF,namely AMF3.
AMF引进于2001年的FlashPlayer6,并且在引入AS2.0的FlashPlayer7和FlashPlayer8中没有改变的保留了。这个版本的AMF参考于AMF0(查阅[AMF0])。在FlashPla yer9中,AS3.0同新的AS虚拟机(AVM+)一起被引进—新的数据类型和语言特性的改进致使AMF升级成为可能,给了一个发布新的AMF版本的机会,新版本的AMF在序列化数据的时候做了一些优化,使得编码格式去除了一些冗余信息。升级后的AMF版本便是AMF3。
Table of Contents目录(略)
1Introduction介绍
1.1Purpose目的
Action Message Format(AMF)is a compact binary format that is used to serialize ActionScr ipt 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 exchangeEVP
of strongly typed data.(译者注:之前有翻译)
The first version of AMF,referred to as AMF0,supports sending complex objects by reference which helps to avoid sending redundant instances in an object graph.
第一个版本的AMF,即AMF0,支持在避免了在对象图中发送冗余的实例的通过引用发送复杂的对象。
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 AMF3to coincide with the release of ActionScr ipt3.0, improves on AMF0by sending object traits and strings by reference in addition to object instances.
新版本的AMF,即AMF3,与AS3.0版本保持一致,在通过引用发送除对象实例外的对象特性和字符串做了改进。
AMF3also supports some new data types introduced in ActionScr ipt3.0.
AMF3也支持在AS3.0中的一些新的数据类型。
1.2Notational Conventions标记转换
1.2.1Augmented BNF参数化的BNF
Type definitions in this specif ication use Augmented Backus-Naur Form(ABNF)syntax[RFC2234].在这个规格中类型定义使用参数化的巴克斯范式(ABNF)语法[RFC2234]。
(译者注:
BNF is a formal meta-syntax used to express context-free Grammars.BNF is one of the most commonly used meta-syntactic notation s for specifying the syntax of programming languages,command sets,PDUs,and similar things.However,pure BNF is rather limited,so the two variations EBNF and ABNF have become more popular.)
The reader should be familiar with this notation before reading this document.
读者在阅读这个文档之前应该熟悉这个注解。
1.3Basic Rules基本规则2011浙江高考语文
Throughout this document bytes are assumed to be octets,or8-bits.
这个文档的字节是8位的。
U8An unsigned byte(8-bits,an octet)
无符号字节(8位,一个8位字节)
U16An unsigned16-bit integer in big endian
(network)byte order
在网络中的字节顺序中的无符号的占用16个二进制位的
整数
U32An unsigned32-bit integer in big endian
(network)byte order
在网络中的字节顺序中的无符号的占用32个二进制位的
晚钟 电影整数
DOUBLE8byte IEEE-754double precision
floating point value in network byte
order(sign bit in low memory).
在网络中的字节循序的(符号位在低存储)8字节的
IEEE-754双精度浮点数
MB A megabyte or1048576bytes.
兆字节
More complicated data type rules require special treatment which is outlined below.
更多的复杂的数据类型规则需要特殊的处理,概括如下:
1.3.1Variable Length Unsigned29-bit Integer Encoding
可变长度的无符号29位整数的编码
AMF3makes use of a special compact format for writing integers to reduce the number of bytes required for encoding.
AMF3使用一种特别的压缩格式来写整数,用于压缩编码的字节数量。
As with a normal32-bit integer,up to4bytes are required to hold the value however the high bit of the first3bytes are used as flags to determine whether the next byte is part of the integer.
对于一个正常的32-bit的整数,需要4个字节来存储,然而前3个字节的最高位是用于标识下一个字节是不是整数的一部分
With up to3bits of the32bits being used as flags,only29significant bits remain for encoding an integer.This means the largest unsigned integer value that can be represented is229–1
在32-bit中多达3个bit是用来标志的,所以对编码的一个整数仅仅有29个bit有意义。这意味着最大的无符号的整数值是229-1。
In ABNF syntax,the variable length unsigned29-bit integer type is described as follows:
在ABNF语法中,可变长度的无符号的29位的整型数据类型描述如下:
1.3.2Strings and UTF-8
AMF0and AMF3use(non-modif ied)UTF-8to encode strings.UTF-8is the abbreviation for8-bit Unicode Transformation Format.UTF-8strings are typically preceded with a byte-length header followed by a sequence of variable length(1to4octets)encoded Unicode code-points.
AMF0和AMF3使用UTF-8来编码字符串(没有变化的)。UTF-8是8-bit的Unicode Transformation Format(统一的传输格式)的缩写。UTF-8字符串是典型的字节长度为头,紧跟着编码Unicode 编码点的可变长度(1到4个字节)的字节序列。
AMF3uses a slightly modif ied byte-length header;a detailed descript ion is provided below and referred to throughout the document.
AMF3使用一个轻微改变的字节长度头;适用于整个文档的具体描述如下。
In ABNF syntax,[RFC3629]describes UTF-8as follows:
在ABNF句法,[RFC3629]描述UTF-8如下:
For AMF3a string can be encoded as a string literal or a string reference.
对于AMF3,一个字符串可以作为字面值或引用来编码。
A variable length unsigned29-bit integer is used for the header and the first bit is flag that specif ies which type of string is encoded.
可变长度的无符号的29-bit的整数用于头,并且第一个bit标识字符串的编码。
If the flag is0,a string literal is encoded and the remaining bits are used to encode the byte-length of the UTF-8encoded String.
辽宁电视台直播生活标识为0时,字符串是字面上编码的,余下的位数是用来编码UTF-8的编码的字节的长度。
If the flag is1,then a string reference is encoded and the remaining bits are used to encode an index to the implicit string reference table.
标识为1时,是字符串引用的编码,余下的位数是用来编码直指隐含的字符串引用表的一个索引。
(译者注:标识位的意义前后定义的不一样)
Note that this encoding imposes some theoret ical limits on the use of Strings.
注意:这个编码增加了字符串使用上的理论上的限制。
The number of unique Strings that can be sent by reference is limited to228-1,and the byte-length of each UTF-8encoded String is limited to228-1bytes(approx256MB).
一个被引用发送的字符串的最大长度是:228-1,每一个UTF-8编码的字符串长度是228-1字节(大概256MB)。
2.Technical Summary技术摘要
2.1Summary of improvements改进的摘要
The follow ing is a table of the improvements and changes in AMF3:
以下是AMF3的改进和改变的目录:
Object traits can now be sent by reference
对象的特性现在可以被引用发送
Strings can now be sent by reference
字符串可以被引用发送
int/uint type support
对int/uint类型的支持
flash.utils.ByteArray type support,can also be sent by reference
对flash.utils.ByteArray类型的支持,也可以通过引用发送
flash.utils.IExternalizable support
对flash.utils.IExternalizable的支持。
Variable length encoding scheme for integers to reduce data size
旨在压缩数据大小的可变长度的整数的编码策略
References are sent using variable length integer
可变长度的整数的引用发送
String UTF-8length uses variable length integer
UTF-8的字符串长度使用可变长度的整数
Array count uses variable length integer
数组的长度使用可变长度的整数
A single Array type marker covers both strict and ECMA Arrays
一个单独的Array数组数据类型覆盖了严格的和ECMA两个数组
Dates no longer send timezone information
日期不再发送时区信息
展开剂Dates can now be sent by reference
日期可以通过引用发送
XMLDocument UTF-8length uses variable length integer
XMLDocument的UTF-8的长度使用可变长度整数
XMLDocument can now be sent by reference
XMLDocument可以通过引用发送
XML type support,can also be sent by reference
XML也可以通过应用发送
XML UTF-8length uses variable length integer
ByteArray type length uses variable length integer
Boolean true and false are now sent as one byte type markers
Boolean类型使用一个字节标识。
Unsupported type marker has been removed
不支持类型标志被删除了
Reserved RecordSet and Movieclip type markers have been removed
保留了RecordSet和Movieclip类型标识被删除了。
2.2Reference Tables
In AMF3,Strings,Complex Objects(which in AMF3are defined as anonymous Objects,typed Objects,Arrays,Dates,XMLDocument,XML,and ByteArrays)and an Object Type's Traits can now be sent by reference.
在AMF3中,字符串,复杂对象(他是AMF3中定义的匿名对象,类型化的对象,数组,日期,xml 文档,xml,字节数组)

本文发布于:2024-09-22 07:00:50,感谢您对本站的认可!

本文链接:https://www.17tex.com/xueshu/542842.html

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。

标签:编码   长度   字节   字符串   对象   整数   引用   使用
留言与评论(共有 0 条评论)
   
验证码:
Copyright ©2019-2024 Comsenz Inc.Powered by © 易纺专利技术学习网 豫ICP备2022007602号 豫公网安备41160202000603 站长QQ:729038198 关于我们 投诉建议