Goole 的 protobuf 即 Protocol Buffers 是一个很好的RPC 框架,支持 c++ python java 接下来进行官方文档的解读,然后你会对protobuf 会有一个很好的认识:
Protocol buffers are language-neutral, platform-netural extensible mechanism for serializing strutctured data ,think xml . but smaller,faster . and simpler
You define how you want your data to be structured once 。then you can use special generated of soure code to easilly write and read your structured data
to and from a variety of data streams and using a variety of languages
即 protocol buffers 是一个语言中立,平台中立的 可扩展机制用于序列化结构化的数据,就像xml 一样,但是它的体积更小,更快,和更简单(放屁用的,难了谁学),
你需要定义一次你的什么样的数据结构,然后即就可以使用特殊生成的源代码去使用各种语言很轻松的读和写你的结构化数据进入到你的各种数据流中
Protocol buffers currently supports generated code in java python ,Objective-C and c++ .With our new proto3 language version ,you can also work with Go ,Ruby ....with more
languages to come
Protocol buffers 当前支持 python .java ob c++ 代码的生成,在proto3 版本中,支持了GO Ruby 等更多语言;
java 如何使用之官方文档 tutorials ---指南,教程
the complete sample code for each application is also provided
在官网中每一个应用都提供了完整的例子代码
this tutorial provides a basic java programmers‘s introduction to working with protocol buffeers ,By walking through creating a simple example application 。it shows you how to
1.Define meassage formats in a .proto file
2.Use the protocol buffer compiler
3.Use the java protocol api to write and read message
这个指南提供了额一个基础的 java 程序在protobuf 运行介绍,通过建立一个简单的例子应用,展示你怎么去
1. 定义消息格式在你的。proto file 文件中
2. 使用protbuf 编译器
3.使用java api 去读写消息
How do you serialize and retrieve structured data like this ? There are a few ways to solve this problem
那你怎么去序列化和收到结构化数据呢,这是一些方式去解决这些问题
1.use java Seralization this is the default approach since it‘s build into the language ,but it has a host of well-known problems ,and also dosen‘t work very well if you need to
share data with applications written in C++ or python
使用java 序列化,它是默认的方法,因为他是java 的内置的,但是它有很多已知的问题,所以如果你需要去分享数据和其他语言,它不能进行很好的工作就是不能用的意思
原文地址:https://www.cnblogs.com/iscys/p/9654405.html