Google protobuf reader-read data

Source: Internet
Author: User

The new project needs to use Java to read data after protobuf-net-data encode, which is really a tough task.

Protobuf-net-data encapsulates the query result into a able. For more information, see the original article.

Let's talk about what I want to do.

  • 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 0108 = 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 0001int fieldId = key >> 3    // right shift 3.


To be continue...

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.