【JAVA】google protobuf 3.0 安装使用

一开始从官网下载的protobuf 3.3.0的最新版本,但是编译安装的时候有bug,回退到3.0稳定版本



tar.gz解压后安装
tar -zxvf xxx.tar.gz
./configure --prefix=/home/protobuf
make
make install


写proto文件
syntax="proto3";
package com.cmcc.protobuf;

message Person {
	string username=1;
	int32 age=2;
	string sex=3;
}

生成java文件



序列化写入磁盘文件并读取出来



猜你喜欢

转载自blog.csdn.net/chiweitree/article/details/76495696