AMQP协议五

8 篇文章 0 订阅

1.2.3 复合数据

       复合数据的封装是由一个长度值和计数器值,以及紧跟计数器值后封装的数据组成的。复合数据中长度值和计数器值对应占用的空间宽度可以通过格式码的类型来计算出来。

                                           +----------= count items =---------+
                                           |                                                 |
    n OCTETs   n OCTETs |                                                 |
    +-------------+---------------+--------------+------------+-----------+
    |     size      |     count     |     ...        / |     item    | \   ...     |
    +-------------+---------------+------------/ +-------------+ \--------+
                                                         / /                    \ \
                                                        / /                      \ \
                                                       / /                        \ \
                                                     +---------------+----------+
                                                     | constructor |   data  |
                                                    +----------------+----------+


                                          Subcategory               n
                                          =================
                                                0xC                       1
                                                0xD                       4


    Type: list
    <type name="list" class="primitive"/>
     Encoding Code  Category                               Description
       list0        0x45  fixed-width, 0 byte value       the empty list (i.e. the list with no elements)
       list8        0xc0   variable-width, 1 byte size    up to 2^8 - 1 list elements with total size less
                                                                              than 2^8octets
       list32      0xd0   variable-width, 4 byte size    up to 2^32 - 1 list elements with total size less
                                                                             than 2^32octets


    Type: map
     <type name="map" class="primitive"/>

    映射数据是按照复合数据封装的,元素是由不同的键-值对组成的。 
    item 0  item 1        item n-1 item n
   +-------+-------+----+---------+---------+
   | key 1 | val 1 | .. | key n/2 | val n/2 |
  +-------+-------+----+---------+---------+

     映射数据包含着一些列选项(等于键-值对的数目和)。在映射数据中,存在两个相同的键索引是不合法的。除非另有原因,否则映射数据必须考虑成有序的,键-值对的有序在语义上是比较重要的,如果两个映射中仅仅是键-值对在顺序上有所不同,那么这两个键-值对封装在映射中的时候是不一样的。
    Encoding  Code   Category                            Description
    map8        0xc1   variable-width, 1 byte size  up to 2^8 - 1 octets of encoded map data
    map32      0xd1   variable-width, 4 byte size  up to 2^32 - 1 octets of encoded map data


 1.2.4 数组

     All array encodings consist of a size followed by a count followed by an element constructor followed
by count elements of encoded data formated as required by the element constructor:

    数组数据组成部分包括:一个长度值,然后是一个计数器值,然后是一个元素的构造器,最后是按照构造器封装的所有的数据。
                                                                               +---= count elements =---+
                                                                                |                                      |
     n OCTETs    n OCTETs                                    |                                      |
    +--------------+----------------+---------------------------+---------+----------+---------+
    |      size      |    count       | element-constructor |     ...    |   data   |    ...     |
    +--------------+----------------+---------------------------+---------+----------+---------+
                                             Subcategory    n
                                        =================
                                                0xE               1
                                                0xF               4


   Type: array

   <type name="array" class="primitive"/>
   Encoding  Code   Category                              Description
     array8     0xe0    variable-width, 1 byte size   up to 2^8 - 1 array elements with total size less
                                                                            than 2^8 octets
     array32    0xf0    variable-width, 4 byte size   up to 2^32 - 1 array elements with total size less
                                                                            than 2^32 octets


1.2.5 封装类型的列表

    Type            Encoding    Code     Category         Description
     null                                 0x40      fixed/0             the null value
     boolean                          0x56      fixed/1             boolean with the octet 0x00 being false and
                                                                                 octet 0x01 being true
     boolean       true             0x41      fixed/0             the boolean value true
     boolean       false            0x42      fixed/0            the boolean value false
     ubyte                              0x50       fixed/1             8-bit unsigned integer
     ushort                             0x60       fixed/2            16-bit unsigned integer in network byte order
     uint                                 0x70       fixed/4            32-bit unsigned integer in network byte order
     uint              smalluint     0x52       fixed/1            unsigned integer value in the range 0 to 255 inclusive
     uint              uint0           0x43       fixed/0            the uint value 0
     ulong                              0x80       fixed/8            64-bit unsigned integer in network byte order
     ulong           smallulong  0x53       fixed/1            unsigned long value in the range 0 to 255 inclusive
     ulong           ulong0        0x44       fixed/0            the ulong value 0
     byte                                0x51       fixed/1            8-bit two's-complement integer
     short                               0x61       fixed/2           16-bit two's-complement integer in network byte order
     int                                   0x71       fixed/4            32-bit two's-complement integer in network byte order
     int                smallint       0x54       fixed/1            signed integer value in the range -128 to 127 inclusive
     long                                0x81       fixed/8            64-bit two's-complement integer in network byte order
     long            smalllong     0x55       fixed/1            signed long value in the range -128 to 127 inclusive
     float            ieee-754      0x72       fixed/4            IEEE 754-2008 binary32
     double        ieee-754      0x82       fixed/8            IEEE 754-2008 binary64
     decimal32   ieee-754      0x74       fixed/4            IEEE 754-2008 decimal32 using the Binary Integer 

                                                                                Decimal encoding
    decimal64    ieee-754      0x84       fixed/8            IEEE 754-2008 decimal64 using the Binary Integer 

                                                                                Decimal encoding
    decimal128  ieee-754      0x94       fixed/16          IEEE 754-2008 decimal128 using the Binary
                                                                                Integer Decimal encoding
    char             utf32            0x73       fixed/4            a UTF-32BE encoded unicode character
    timestamp    ms64           0x83       fixed/8            64-bit signed integer representing milliseconds
                                                                                since the unix epoch
    uuid                                 0x98       fixed/16          UUID as de ned in section 4.1.2 of RFC-4122
    binary          vbin8           0xa0       variable/1       up to 2^8 - 1 octets of binary data
    binary          vbin32         0xb0       variable/4       up to 2^32 - 1 octets of binary data
    string           str8-utf8      0xa1       variable/1       up to 2^8 - 1 octets worth of UTF-8 unicode
                                                                                (with no byte order mark)
    string           str32-utf8    0xb1       variable/4       up to 2^32 - 1 octets worth of UTF-8 unicode
                                                                                (with no byte order mark)
    symbol         sym8          0xa3       variable/1       up to 2^8 - 1 seven bit ASCII characters 

                                                                                representing a symbolic value
    symbol        sym32         0xb3       variable/4       up to 2^32 - 1 seven bit ASCII characters

                                                                                representing a symbolic value
    list               list0             0x45       fixed/0            the empty list (i.e. the list with no elements)
    list               list8             0xc0       compound/1   up to 2^8 - 1 list elements with total size less
                                                                                than 2^8 octets
    list               list32           0xd0       compound/4   up to 2^32 - 1 list elements with total size less
                                                                                than 2^32 octets
    map            map8           0xc1       compound/1   up to 2^8 - 1 octets of encoded map data
    map            map32         0xd1       compound/4   up to 2^32 - 1 octets of encoded map data
    array          array8          0xe0       array/1            up to 2^8 - 1 array elements with total size less
                                                                                than 2^8 octets
    array          array32        0xf0        array/4            up to 2^32 - 1 array elements with total size less
                                                                                than 2^32 octets

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值