Comparison of two versions of AMF Protocol Data Processing

Source: Internet
Author: User

In the previous article, we have introduced the basic situation of the AMF protocol. I believe you have some knowledge about this agreement. Now let's take a brief look at its basic information. Then we will introduce the differences in data processing between the two versions.

The AMF protocol is short for the Action Message Format protocol. The AMF protocol is a protocol of Adobe, which is mainly used for data interaction and Remote Process calling. It is functionally equivalent to WebService, however, the difference between AMF and xml in WebService is that AMF is binary data, while xml is text data, and AMF transmission efficiency is higher than xml. AMF uses http transmission and is currently mainly used in ActionScript, implement communication between Flex and Service. Currently, the latest version is AMF3. The biggest feature of AMF is that it can directly transmit Flash built-in objects, such as Object, Array, Date, XML, to the server, in addition, it is automatically parsed on the server to an appropriate object, which reduces the complex work of developers and saves development time. Because AMF uses binary encoding, this method can compress data highly (misunderstanding of AMF3 in flash), so it is very suitable for transferring a large amount of data 。

The larger the data volume, the higher the transmission efficiency of Flash Remoting, far greater than the Web Service. As for XML, they use plain text transmission, efficiency cannot be compared with Flash Remoting. In addition to AMF encoding for efficient data operations, Byte Array also has a cool function, that is, Copy (Clone) from the memory) for the entire Object, see use Byte Array and AMF to improve the efficiency of Data Object operations 。

There are currently two versions of the AMF protocol, AMF0 and AMF3, which have slightly different definitions of data types 。

 
 
  1. TypeByte codeNotes  
  2. Number0×00   
  3. Boolean0×01   
  4. String0×02   
  5. Object0×03   
  6. MovieClip0×04Not available in Remoting  
  7. Null0×05   
  8. Undefined0×06   
  9. Reference0×07   
  10. MixedArray0×08   
  11. EndOfObject0×09See Object  
  12. Array0x0a   
  13. Date0x0b   
  14. LongString0x0c   
  15. Unsupported0x0d  
  16. Recordset0x0e Remoting, server-to-client only  
  17. XML0x0f  
  18. TypedObject (Class instance)0×10  
  19. AMF3 data0×11 Sent by Flash player 9+ 

The corresponding enumeration is

 
 
  1. public enum DataType  
  2. {  
  3.  Number = 0,  
  4.  Boolean = 1,  
  5.  String = 2,  
  6.  UntypedObject = 3,  
  7.  MovieClip = 4,  
  8.  Null = 5,  
  9.  Undefined = 6,  
  10.  ReferencedObject = 7,  
  11.  MixedArray = 8,  
  12.  End = 9,  
  13.  Array = 10,//0x0A  
  14.  Date = 11,//0x0B  
  15.  LongString = 12,//0x0C  
  16.  TypeAsObject = 13,//0x0D  
  17.  Recordset = 14,//0x0E  
  18.  Xml = 15,//0x0F  
  19.  TypedObject = 16,//0x10  
  20.  AMF3data=17//0x11 

The preceding table lists the representation of each data type of the AMF protocol.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.