MessagePack手记1

MessagePack 有两个概念: type system and formats.

一、Type system:

1、Extension type(面向应用的扩展类型:由一个整型和一个字节数组构成)

MessagePack allows applications to define application-specific types using the Extension type. Extension type consists of an integer and a byte array where the integer represents a kind of types and the byte array represents data.

Applications can assign 0 to 127 to store application-specific type information.

MessagePack reserves -1 to -128 for future extension to add predefined types which will be described in separated documents.

[0, 127]: application-specific types
[-128, -1]: reserved for predefined types


说明:

例如在对一个java对象进行序列化的时候其实就是把这个对象的属性按bean定义顺序逐一构成一个array进行的编码;

例如对该bean进行序列化:

序列化后的十六进制为:9401a162a163c2

解读:上边说了,第一个int是由0~127构成的类型说明,此处为97

            随后的“01”表示类型为int,值此处为1

            随后的“a162”表示类型为fixstr,值此处为a(62)

            随后的“a163”表示类型为fixstr,值此处为b(63)

            随后的“c2”表示类型为boolean,值此处为false

疑问:在messagepack对于Formats的Overview中,fixstr    101xxxxx    0xa0-0xbf,这里是a1,那a2~bf又是表示什么呢?

           且听下回分解 =。=


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值