码迷,mamicode.com
首页 > 其他好文 > 详细

Google Protobuf Reader - Read Data

时间:2014-07-30 05:36:53      阅读:280      评论:0      收藏:0      [点我收藏+]

标签:style   http   color   java   数据   ar   line   amp   

新项目需要 用 Java 读取 protobuf-net-data encode之后的数据,实在是个让人蛋疼的任务。

protobuf-net-data 把 查询结果封装成 DataTable,用法自己参考原文

这里说说我要做的事情

  • Understand Protobuf Encoding

  • Decoding

  • Java ResultSet

  1. Protobuf how to encoding: Google Doc

    a protocol buffer message is a series of key-value pairs

message Test1 {
  required int32 a = 1;
}

08 96 01

08 = 0000 0001

 Each key in the streamed message is a varint with the value (field_number << 3) | wire_type

int key = readVarInt(inputStream);
int wireType = key & 0x07 // 0000 0001
int fieldId = key >> 3    // right shift 3.


to be continue...

Google Protobuf Reader - Read Data,布布扣,bubuko.com

Google Protobuf Reader - Read Data

标签:style   http   color   java   数据   ar   line   amp   

原文地址:http://my.oschina.net/u/1767744/blog/296057

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!