Protobuf profile

Rrotobuf is an open source project released by Google. The full name of Rrotobuf is Google Protocol Buffers. Rrotobuf is a lightweight and efficient structured data storage format that can be used for data serialization. It is language-independent, platform-independent and has good scalability. ProtoBuf, like all serialization frameworks, can be used for data storage and communication protocols.

Portobuf serialized result volume is much smaller than XML, JSON, XML and JSON too much description information, resulting in a larger message; In addition, Portobuf uses VARINT encoding to reduce the space footprint of data.

Portobuf serialization and deserialization is much faster than XML, JSON, and directly convert objects and byte arrays, while XML and JSON need to be constructed into XML or JSON object structures.

Install the tutorial

Search for proto in the Idea plugins and download the following plugins (the most downloaded plugins) : I have already installed them here, click Install and restart.

Using the tutorial

First introduce dependencies

< the dependency > < groupId > com. Google. Protobuf < / groupId > < artifactId > protobuf - Java < / artifactId > < version > 3.6.1 pr < / version > </dependency>

Create a new student. proto file in Idea and write:

syntax = "proto3"; // version option java_outer_classname = "studentPOJO "; Message Student {// create an inner Student within the studentPOJO external class; // create a Student within the studentPOJO external class; Int32 id = 1; int32 id = 1; String name = 2; String name = 2; String name = 2; String name = 2; String name = 2; String name = 2; String name = 2; }

Then compile it locally and download the protoc.exe program.

Use the command protoc.exe –java_out =.student. proto and place the generated studentPOJO in your project for use.

Reference books Jane