AMF data the first byte for the type of this data, the types are:
Number |
0x00 |
Double type |
Boolean |
0x01 |
type bool |
String |
0x02 |
String type |
Object |
0x03 |
Object Type |
MovieClip |
0x04 |
Not available in Remoting |
Null |
0x05 |
NULL type, NULL |
Undefined |
0x06 |
|
Reference |
0x07 |
|
Mixedarray |
0x08 |
|
Endofobject |
0x09 |
An object that represents the end of an object |
Array |
0x0a |
|
Date |
0x0b |
|
Longstring |
0x0c |
|
Unsupported |
0x0d |
|
Recordset |
0x0e |
Remoting, Server-to-client only |
Xml |
0x0f |
|
Typedobject (Class instance) |
0x10 |
|
AMF3 data |
0x11 |
Sent by Flash player 9+ |
The corresponding enumeration is: public enum datatype{number = 00,//0 Boolean = 01,//1 String = 02,//2 Untypedobject = 03,//3 Movie Clip = 04,//4 Null = 05,//5 Undefined = 06,//6 referencedobject = 07,//7 Mixedarray = 08,//8 end = 09,//9 Array = 10 ,//Date = 11,//longstring = 12,//Typeasobject = 13,//Recordset = 14,//-Xml = 15,//Typedobject = 16, Amf3data = 17// RTMP the data in the protocol is big-end, so the data should be turned into big-endian form before putting the data. Number type is actually double, accounting for 8bytes. For example: 00 00 00 00 00 00 00 00, the first byte is the AMF type, and then the 8bytes is the double value 0.0. Boolean is a Boolean type that takes up 1byte. For example: 01 00, the first byte is the AMF type, and then the 1byte is the value, False. String is the character type, a byte AMF type, two bytes character lengths, and N bytes data. For example: 02 00 02 33 22, the first byte is the AMF type, followed by two bytes for length, note that here 00 02 is big-endian mode, 33 22 is character data. NULL is NULL, only one byte,0x05. Object type to be complex, the first byte is 03 for object, followed by N (key+value). Finally, the object ends with 00 00 09. Key is a string composition: 2bytes length, N bytes data, is the function of value, equivalent to the name of value. Value can make AMF any type, including object. Format and individual AMF Type, if it is object, it is equivalent to nesting an object inside. The status after level (key) is value, which is a string type, so the format is the string type mentioned above (0x02). Ecma_array (0x08) is actually about the same as object, but only after the 0x08 type of 4 more bytes Records of the total number of items, visual total 00 can also be, but also to 00 00 09 end. 0x11 type is the type of AMF3, AMF3 is actually a layer of amf0, in order to be compatible with amf0, I have no use, have not studied.