Google Protobuf 使用 Java 版
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Google Protobuf 使用 Java 版,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含46838字,纯文字阅读大概需要67分钟。
内容图文
![Google Protobuf 使用 Java 版](/upload/InfoBanner/zyjiaocheng/1218/058381416e5d47e6805d46ac77d25241.jpg)
一 . Protobuf 的入门
Protobuf 是一个灵活,高效,结构化的数据序列化框架, 相比于 XML 等传统的序列化工具,它更小,更快,更灵活,更简单. Protobuf 支持数据结构化一次可以到处使用.甚至跨语言使用.同通过代码生成工具可以自动生成不同语言版本的源代码,甚至可以在使用不同版本的数据结构中进行数据传递,实现数据结构的向前兼容.
Google 的 protobuf 在业界非常流行,很多商业项目选择 protobuf 作为编码解码框架,这里我们一起回顾一下 Protobuf 的优点.
- 在 Google 内长期使用,产品成熟度高;
- 跨语言,支持多种语言,包括 c++,Java, 和 Python;
- 编码后的消息更小,更加有利于存储和传输;
- 编码的性能非常高;
- 支持不同协议版本的向前兼容;
- 支持定义可选和必选字段;
如图:
二. Protobuf 的使用(mac 环境下).
1. 环境搭建
1.1 下载 protobuf
http://pan.baidu.com/s/1dDyEUjR
1.2. 安装
tar -zxf protobuf-2.5.0.tar.gz cd protobuf-2.5.0 ./configure --prefix=/Users/mjorcen/dev/tools/protobuf make & makeinstall
注 : /Users/mjorcen/dev/tools/protobuf 为自己设定的编译安装目录
1.3. 配置环境变量
sudo vi .bash_profile export PROTOBUF=/Users/mjorcen/dev/tools/protobuf export PATH=$PROTOBUF/bin:$PATH
1.4. 测试
protoc --version
2 . Protobuf 入门
2.1 定义数据结构;
package netty ; option java_package = “object.server.impl”; option java_outer_classname = “SubScriptReqProto”; message SubScriptReq{ required int32 subReqID = 1 ; required string userName = 2 ; required string productName = 3 ; required string address = 4 ; }
package netty ; option java_package = “object.server.impl”; option java_outer_classname = “SubScriptRespProto”; message SubScriptResp{ required int32 subReqID = 1 ; required int32 respCode = 2 ; required string desc = 3 ; }
2.2 通过 Protobuf 命令生成代码
MjorcendeMacBook-Air:tmp mjorcen$ /Users/mjorcen/dev/tools/protobuf/bin/protoc --java_out=./src ./netty/SubScriptReq.proto
MjorcendeMacBook-Air:tmp mjorcen$ /Users/mjorcen/dev/tools/protobuf/bin/protoc --java_out=./src ./netty/SubScriptResp.proto
2.3 把生成的 Java 文件复制放入项目中.
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: netty/SubScriptReq.proto package object.server.impl; public final class SubScriptReqProto { private SubScriptReqProto() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { } public interface SubScriptReqOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 subReqID = 1; /** * <code>required int32 subReqID = 1;</code> */ boolean hasSubReqID(); /** * <code>required int32 subReqID = 1;</code> */ int getSubReqID(); // required string userName = 2; /** * <code>required string userName = 2;</code> */ boolean hasUserName(); /** * <code>required string userName = 2;</code> */ java.lang.String getUserName(); /** * <code>required string userName = 2;</code> */ com.google.protobuf.ByteString getUserNameBytes(); // required string productName = 3; /** * <code>required string productName = 3;</code> */ boolean hasProductName(); /** * <code>required string productName = 3;</code> */ java.lang.String getProductName(); /** * <code>required string productName = 3;</code> */ com.google.protobuf.ByteString getProductNameBytes(); // required string address = 4; /** * <code>required string address = 4;</code> */ boolean hasAddress(); /** * <code>required string address = 4;</code> */ java.lang.String getAddress(); /** * <code>required string address = 4;</code> */ com.google.protobuf.ByteString getAddressBytes(); } /** * Protobuf type { @code netty.SubScriptReq} */ public static final class SubScriptReq extends com.google.protobuf.GeneratedMessage implements SubScriptReqOrBuilder { // Use SubScriptReq.newBuilder() to construct.private SubScriptReq(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private SubScriptReq(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } privatestaticfinal SubScriptReq defaultInstance; publicstatic SubScriptReq getDefaultInstance() { return defaultInstance; } public SubScriptReq getDefaultInstanceForType() { return defaultInstance; } privatefinal com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override publicfinal com.google.protobuf.UnknownFieldSet getUnknownFields() { returnthis.unknownFields; } private SubScriptReq( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; subReqID_ = input.readInt32(); break; } case 18: { bitField0_ |= 0x00000002; userName_ = input.readBytes(); break; } case 26: { bitField0_ |= 0x00000004; productName_ = input.readBytes(); break; } case 34: { bitField0_ |= 0x00000008; address_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { thrownew com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } publicstaticfinal com.google.protobuf.Descriptors.Descriptor getDescriptor() { return object.server.impl.SubScriptReqProto.internal_static_netty_SubScriptReq_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return object.server.impl.SubScriptReqProto.internal_static_netty_SubScriptReq_fieldAccessorTable .ensureFieldAccessorsInitialized( object.server.impl.SubScriptReqProto.SubScriptReq.class, object.server.impl.SubScriptReqProto.SubScriptReq.Builder.class); } publicstatic com.google.protobuf.Parser<SubScriptReq> PARSER = new com.google.protobuf.AbstractParser<SubScriptReq>() { public SubScriptReq parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { returnnew SubScriptReq(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser<SubScriptReq> getParserForType() { return PARSER; } privateint bitField0_; // required int32 subReqID = 1;publicstaticfinalint SUBREQID_FIELD_NUMBER = 1; privateint subReqID_; /** * <code>required int32 subReqID = 1;</code> */publicboolean hasSubReqID() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * <code>required int32 subReqID = 1;</code> */publicint getSubReqID() { return subReqID_; } // required string userName = 2;publicstaticfinalint USERNAME_FIELD_NUMBER = 2; private java.lang.Object userName_; /** * <code>required string userName = 2;</code> */publicboolean hasUserName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * <code>required string userName = 2;</code> */public java.lang.String getUserName() { java.lang.Object ref = userName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { userName_ = s; } return s; } } /** * <code>required string userName = 2;</code> */public com.google.protobuf.ByteString getUserNameBytes() { java.lang.Object ref = userName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); userName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string productName = 3;publicstaticfinalint PRODUCTNAME_FIELD_NUMBER = 3; private java.lang.Object productName_; /** * <code>required string productName = 3;</code> */publicboolean hasProductName() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * <code>required string productName = 3;</code> */public java.lang.String getProductName() { java.lang.Object ref = productName_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { productName_ = s; } return s; } } /** * <code>required string productName = 3;</code> */public com.google.protobuf.ByteString getProductNameBytes() { java.lang.Object ref = productName_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); productName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } // required string address = 4;publicstaticfinalint ADDRESS_FIELD_NUMBER = 4; private java.lang.Object address_; /** * <code>required string address = 4;</code> */publicboolean hasAddress() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * <code>required string address = 4;</code> */public java.lang.String getAddress() { java.lang.Object ref = address_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { address_ = s; } return s; } } /** * <code>required string address = 4;</code> */public com.google.protobuf.ByteString getAddressBytes() { java.lang.Object ref = address_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); address_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } privatevoid initFields() { subReqID_ = 0; userName_ = ""; productName_ = ""; address_ = ""; } privatebyte memoizedIsInitialized = -1; publicfinalboolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasSubReqID()) { memoizedIsInitialized = 0; returnfalse; } if (!hasUserName()) { memoizedIsInitialized = 0; returnfalse; } if (!hasProductName()) { memoizedIsInitialized = 0; returnfalse; } if (!hasAddress()) { memoizedIsInitialized = 0; returnfalse; } memoizedIsInitialized = 1; returntrue; } publicvoid writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, subReqID_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeBytes(2, getUserNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getProductNameBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { output.writeBytes(4, getAddressBytes()); } getUnknownFields().writeTo(output); } privateint memoizedSerializedSize = -1; publicint getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, subReqID_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(2, getUserNameBytes()); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getProductNameBytes()); } if (((bitField0_ & 0x00000008) == 0x00000008)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(4, getAddressBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } privatestaticfinallong serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { returnsuper.writeReplace(); } publicstatic object.server.impl.SubScriptReqProto.SubScriptReq parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } publicstatic object.server.impl.SubScriptReqProto.SubScriptReq parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } publicstatic object.server.impl.SubScriptReqProto.SubScriptReq parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } publicstatic object.server.impl.SubScriptReqProto.SubScriptReq parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } publicstatic object.server.impl.SubScriptReqProto.SubScriptReq parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } publicstatic object.server.impl.SubScriptReqProto.SubScriptReq parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } publicstatic object.server.impl.SubScriptReqProto.SubScriptReq parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } publicstatic object.server.impl.SubScriptReqProto.SubScriptReq parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } publicstatic object.server.impl.SubScriptReqProto.SubScriptReq parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } publicstatic object.server.impl.SubScriptReqProto.SubScriptReq parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } publicstatic Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } publicstatic Builder newBuilder(object.server.impl.SubScriptReqProto.SubScriptReq prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code netty.SubScriptReq} */publicstaticfinalclass Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements object.server.impl.SubScriptReqProto.SubScriptReqOrBuilder { publicstaticfinal com.google.protobuf.Descriptors.Descriptor getDescriptor() { return object.server.impl.SubScriptReqProto.internal_static_netty_SubScriptReq_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return object.server.impl.SubScriptReqProto.internal_static_netty_SubScriptReq_fieldAccessorTable .ensureFieldAccessorsInitialized( object.server.impl.SubScriptReqProto.SubScriptReq.class, object.server.impl.SubScriptReqProto.SubScriptReq.Builder.class); } // Construct using object.server.impl.SubScriptReqProto.SubScriptReq.newBuilder()private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } privatevoid maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } privatestatic Builder create() { returnnew Builder(); } public Builder clear() { super.clear(); subReqID_ = 0; bitField0_ = (bitField0_ & ~0x00000001); userName_ = ""; bitField0_ = (bitField0_ & ~0x00000002); productName_ = ""; bitField0_ = (bitField0_ & ~0x00000004); address_ = ""; bitField0_ = (bitField0_ & ~0x00000008); returnthis; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return object.server.impl.SubScriptReqProto.internal_static_netty_SubScriptReq_descriptor; } public object.server.impl.SubScriptReqProto.SubScriptReq getDefaultInstanceForType() { return object.server.impl.SubScriptReqProto.SubScriptReq.getDefaultInstance(); } public object.server.impl.SubScriptReqProto.SubScriptReq build() { object.server.impl.SubScriptReqProto.SubScriptReq result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public object.server.impl.SubScriptReqProto.SubScriptReq buildPartial() { object.server.impl.SubScriptReqProto.SubScriptReq result = new object.server.impl.SubScriptReqProto.SubScriptReq(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.subReqID_ = subReqID_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.userName_ = userName_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.productName_ = productName_; if (((from_bitField0_ & 0x00000008) == 0x00000008)) { to_bitField0_ |= 0x00000008; } result.address_ = address_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof object.server.impl.SubScriptReqProto.SubScriptReq) { return mergeFrom((object.server.impl.SubScriptReqProto.SubScriptReq)other); } else { super.mergeFrom(other); returnthis; } } public Builder mergeFrom(object.server.impl.SubScriptReqProto.SubScriptReq other) { if (other == object.server.impl.SubScriptReqProto.SubScriptReq.getDefaultInstance()) returnthis; if (other.hasSubReqID()) { setSubReqID(other.getSubReqID()); } if (other.hasUserName()) { bitField0_ |= 0x00000002; userName_ = other.userName_; onChanged(); } if (other.hasProductName()) { bitField0_ |= 0x00000004; productName_ = other.productName_; onChanged(); } if (other.hasAddress()) { bitField0_ |= 0x00000008; address_ = other.address_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); returnthis; } publicfinalboolean isInitialized() { if (!hasSubReqID()) { returnfalse; } if (!hasUserName()) { returnfalse; } if (!hasProductName()) { returnfalse; } if (!hasAddress()) { returnfalse; } returntrue; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { object.server.impl.SubScriptReqProto.SubScriptReq parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (object.server.impl.SubScriptReqProto.SubScriptReq) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } returnthis; } privateint bitField0_; // required int32 subReqID = 1;privateint subReqID_ ; /** * <code>required int32 subReqID = 1;</code> */publicboolean hasSubReqID() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * <code>required int32 subReqID = 1;</code> */publicint getSubReqID() { return subReqID_; } /** * <code>required int32 subReqID = 1;</code> */public Builder setSubReqID(int value) { bitField0_ |= 0x00000001; subReqID_ = value; onChanged(); returnthis; } /** * <code>required int32 subReqID = 1;</code> */public Builder clearSubReqID() { bitField0_ = (bitField0_ & ~0x00000001); subReqID_ = 0; onChanged(); returnthis; } // required string userName = 2;private java.lang.Object userName_ = ""; /** * <code>required string userName = 2;</code> */publicboolean hasUserName() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * <code>required string userName = 2;</code> */public java.lang.String getUserName() { java.lang.Object ref = userName_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); userName_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>required string userName = 2;</code> */public com.google.protobuf.ByteString getUserNameBytes() { java.lang.Object ref = userName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); userName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>required string userName = 2;</code> */public Builder setUserName( java.lang.String value) { if (value == null) { thrownew NullPointerException(); } bitField0_ |= 0x00000002; userName_ = value; onChanged(); returnthis; } /** * <code>required string userName = 2;</code> */public Builder clearUserName() { bitField0_ = (bitField0_ & ~0x00000002); userName_ = getDefaultInstance().getUserName(); onChanged(); returnthis; } /** * <code>required string userName = 2;</code> */public Builder setUserNameBytes( com.google.protobuf.ByteString value) { if (value == null) { thrownew NullPointerException(); } bitField0_ |= 0x00000002; userName_ = value; onChanged(); returnthis; } // required string productName = 3;private java.lang.Object productName_ = ""; /** * <code>required string productName = 3;</code> */publicboolean hasProductName() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * <code>required string productName = 3;</code> */public java.lang.String getProductName() { java.lang.Object ref = productName_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); productName_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>required string productName = 3;</code> */public com.google.protobuf.ByteString getProductNameBytes() { java.lang.Object ref = productName_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); productName_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>required string productName = 3;</code> */public Builder setProductName( java.lang.String value) { if (value == null) { thrownew NullPointerException(); } bitField0_ |= 0x00000004; productName_ = value; onChanged(); returnthis; } /** * <code>required string productName = 3;</code> */public Builder clearProductName() { bitField0_ = (bitField0_ & ~0x00000004); productName_ = getDefaultInstance().getProductName(); onChanged(); returnthis; } /** * <code>required string productName = 3;</code> */public Builder setProductNameBytes( com.google.protobuf.ByteString value) { if (value == null) { thrownew NullPointerException(); } bitField0_ |= 0x00000004; productName_ = value; onChanged(); returnthis; } // required string address = 4;private java.lang.Object address_ = ""; /** * <code>required string address = 4;</code> */publicboolean hasAddress() { return ((bitField0_ & 0x00000008) == 0x00000008); } /** * <code>required string address = 4;</code> */public java.lang.String getAddress() { java.lang.Object ref = address_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); address_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>required string address = 4;</code> */public com.google.protobuf.ByteString getAddressBytes() { java.lang.Object ref = address_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); address_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>required string address = 4;</code> */public Builder setAddress( java.lang.String value) { if (value == null) { thrownew NullPointerException(); } bitField0_ |= 0x00000008; address_ = value; onChanged(); returnthis; } /** * <code>required string address = 4;</code> */public Builder clearAddress() { bitField0_ = (bitField0_ & ~0x00000008); address_ = getDefaultInstance().getAddress(); onChanged(); returnthis; } /** * <code>required string address = 4;</code> */public Builder setAddressBytes( com.google.protobuf.ByteString value) { if (value == null) { thrownew NullPointerException(); } bitField0_ |= 0x00000008; address_ = value; onChanged(); returnthis; } // @@protoc_insertion_point(builder_scope:netty.SubScriptReq) } static { defaultInstance = new SubScriptReq(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:netty.SubScriptReq) } privatestatic com.google.protobuf.Descriptors.Descriptor internal_static_netty_SubScriptReq_descriptor; privatestatic com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_netty_SubScriptReq_fieldAccessorTable; publicstatic com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } privatestatic com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n\030netty/SubScriptReq.proto\022\005netty\"X\n\014Sub" + "ScriptReq\022\020\n\010subReqID\030\001 \002(\005\022\020\n\010userName\030" + "\002 \002(\t\022\023\n\013productName\030\003 \002(\t\022\017\n\007address\030\004 " + "\002(\tB\‘\n\022object.server.implB\021SubScriptReqP" + "roto" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; internal_static_netty_SubScriptReq_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_netty_SubScriptReq_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_netty_SubScriptReq_descriptor, new java.lang.String[] { "SubReqID", "UserName", "ProductName", "Address", }); returnnull; } }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { }, assigner); } // @@protoc_insertion_point(outer_class_scope) }
// Generated by the protocol buffer compiler. DO NOT EDIT! // source: netty/SubScriptResp.proto package object.server.impl; public final class SubScriptRespProto { private SubScriptRespProto() {} public static void registerAllExtensions( com.google.protobuf.ExtensionRegistry registry) { } public interface SubScriptRespOrBuilder extends com.google.protobuf.MessageOrBuilder { // required int32 subReqID = 1; /** * <code>required int32 subReqID = 1;</code> */ boolean hasSubReqID(); /** * <code>required int32 subReqID = 1;</code> */ int getSubReqID(); // required int32 respCode = 2; /** * <code>required int32 respCode = 2;</code> */ boolean hasRespCode(); /** * <code>required int32 respCode = 2;</code> */ int getRespCode(); // required string desc = 3; /** * <code>required string desc = 3;</code> */ boolean hasDesc(); /** * <code>required string desc = 3;</code> */ java.lang.String getDesc(); /** * <code>required string desc = 3;</code> */ com.google.protobuf.ByteString getDescBytes(); } /** * Protobuf type { @code netty.SubScriptResp} */ public static final class SubScriptResp extends com.google.protobuf.GeneratedMessage implements SubScriptRespOrBuilder { // Use SubScriptResp.newBuilder() to construct.private SubScriptResp(com.google.protobuf.GeneratedMessage.Builder<?> builder) { super(builder); this.unknownFields = builder.getUnknownFields(); } private SubScriptResp(boolean noInit) { this.unknownFields = com.google.protobuf.UnknownFieldSet.getDefaultInstance(); } privatestaticfinal SubScriptResp defaultInstance; publicstatic SubScriptResp getDefaultInstance() { return defaultInstance; } public SubScriptResp getDefaultInstanceForType() { return defaultInstance; } privatefinal com.google.protobuf.UnknownFieldSet unknownFields; @java.lang.Override publicfinal com.google.protobuf.UnknownFieldSet getUnknownFields() { returnthis.unknownFields; } private SubScriptResp( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { initFields(); int mutable_bitField0_ = 0; com.google.protobuf.UnknownFieldSet.Builder unknownFields = com.google.protobuf.UnknownFieldSet.newBuilder(); try { boolean done = false; while (!done) { int tag = input.readTag(); switch (tag) { case 0: done = true; break; default: { if (!parseUnknownField(input, unknownFields, extensionRegistry, tag)) { done = true; } break; } case 8: { bitField0_ |= 0x00000001; subReqID_ = input.readInt32(); break; } case 16: { bitField0_ |= 0x00000002; respCode_ = input.readInt32(); break; } case 26: { bitField0_ |= 0x00000004; desc_ = input.readBytes(); break; } } } } catch (com.google.protobuf.InvalidProtocolBufferException e) { throw e.setUnfinishedMessage(this); } catch (java.io.IOException e) { thrownew com.google.protobuf.InvalidProtocolBufferException( e.getMessage()).setUnfinishedMessage(this); } finally { this.unknownFields = unknownFields.build(); makeExtensionsImmutable(); } } publicstaticfinal com.google.protobuf.Descriptors.Descriptor getDescriptor() { return object.server.impl.SubScriptRespProto.internal_static_netty_SubScriptResp_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return object.server.impl.SubScriptRespProto.internal_static_netty_SubScriptResp_fieldAccessorTable .ensureFieldAccessorsInitialized( object.server.impl.SubScriptRespProto.SubScriptResp.class, object.server.impl.SubScriptRespProto.SubScriptResp.Builder.class); } publicstatic com.google.protobuf.Parser<SubScriptResp> PARSER = new com.google.protobuf.AbstractParser<SubScriptResp>() { public SubScriptResp parsePartialFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { returnnew SubScriptResp(input, extensionRegistry); } }; @java.lang.Override public com.google.protobuf.Parser<SubScriptResp> getParserForType() { return PARSER; } privateint bitField0_; // required int32 subReqID = 1;publicstaticfinalint SUBREQID_FIELD_NUMBER = 1; privateint subReqID_; /** * <code>required int32 subReqID = 1;</code> */publicboolean hasSubReqID() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * <code>required int32 subReqID = 1;</code> */publicint getSubReqID() { return subReqID_; } // required int32 respCode = 2;publicstaticfinalint RESPCODE_FIELD_NUMBER = 2; privateint respCode_; /** * <code>required int32 respCode = 2;</code> */publicboolean hasRespCode() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * <code>required int32 respCode = 2;</code> */publicint getRespCode() { return respCode_; } // required string desc = 3;publicstaticfinalint DESC_FIELD_NUMBER = 3; private java.lang.Object desc_; /** * <code>required string desc = 3;</code> */publicboolean hasDesc() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * <code>required string desc = 3;</code> */public java.lang.String getDesc() { java.lang.Object ref = desc_; if (ref instanceof java.lang.String) { return (java.lang.String) ref; } else { com.google.protobuf.ByteString bs = (com.google.protobuf.ByteString) ref; java.lang.String s = bs.toStringUtf8(); if (bs.isValidUtf8()) { desc_ = s; } return s; } } /** * <code>required string desc = 3;</code> */public com.google.protobuf.ByteString getDescBytes() { java.lang.Object ref = desc_; if (ref instanceof java.lang.String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); desc_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } privatevoid initFields() { subReqID_ = 0; respCode_ = 0; desc_ = ""; } privatebyte memoizedIsInitialized = -1; publicfinalboolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; if (!hasSubReqID()) { memoizedIsInitialized = 0; returnfalse; } if (!hasRespCode()) { memoizedIsInitialized = 0; returnfalse; } if (!hasDesc()) { memoizedIsInitialized = 0; returnfalse; } memoizedIsInitialized = 1; returntrue; } publicvoid writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { output.writeInt32(1, subReqID_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { output.writeInt32(2, respCode_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { output.writeBytes(3, getDescBytes()); } getUnknownFields().writeTo(output); } privateint memoizedSerializedSize = -1; publicint getSerializedSize() { int size = memoizedSerializedSize; if (size != -1) return size; size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(1, subReqID_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream .computeInt32Size(2, respCode_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream .computeBytesSize(3, getDescBytes()); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; return size; } privatestaticfinallong serialVersionUID = 0L; @java.lang.Override protected java.lang.Object writeReplace() throws java.io.ObjectStreamException { returnsuper.writeReplace(); } publicstatic object.server.impl.SubScriptRespProto.SubScriptResp parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } publicstatic object.server.impl.SubScriptRespProto.SubScriptResp parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } publicstatic object.server.impl.SubScriptRespProto.SubScriptResp parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data); } publicstatic object.server.impl.SubScriptRespProto.SubScriptResp parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return PARSER.parseFrom(data, extensionRegistry); } publicstatic object.server.impl.SubScriptRespProto.SubScriptResp parseFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } publicstatic object.server.impl.SubScriptRespProto.SubScriptResp parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } publicstatic object.server.impl.SubScriptRespProto.SubScriptResp parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { return PARSER.parseDelimitedFrom(input); } publicstatic object.server.impl.SubScriptRespProto.SubScriptResp parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseDelimitedFrom(input, extensionRegistry); } publicstatic object.server.impl.SubScriptRespProto.SubScriptResp parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return PARSER.parseFrom(input); } publicstatic object.server.impl.SubScriptRespProto.SubScriptResp parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return PARSER.parseFrom(input, extensionRegistry); } publicstatic Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } publicstatic Builder newBuilder(object.server.impl.SubScriptRespProto.SubScriptResp prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @java.lang.Override protected Builder newBuilderForType( com.google.protobuf.GeneratedMessage.BuilderParent parent) { Builder builder = new Builder(parent); return builder; } /** * Protobuf type {@code netty.SubScriptResp} */publicstaticfinalclass Builder extends com.google.protobuf.GeneratedMessage.Builder<Builder> implements object.server.impl.SubScriptRespProto.SubScriptRespOrBuilder { publicstaticfinal com.google.protobuf.Descriptors.Descriptor getDescriptor() { return object.server.impl.SubScriptRespProto.internal_static_netty_SubScriptResp_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { return object.server.impl.SubScriptRespProto.internal_static_netty_SubScriptResp_fieldAccessorTable .ensureFieldAccessorsInitialized( object.server.impl.SubScriptRespProto.SubScriptResp.class, object.server.impl.SubScriptRespProto.SubScriptResp.Builder.class); } // Construct using object.server.impl.SubScriptRespProto.SubScriptResp.newBuilder()private Builder() { maybeForceBuilderInitialization(); } private Builder( com.google.protobuf.GeneratedMessage.BuilderParent parent) { super(parent); maybeForceBuilderInitialization(); } privatevoid maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { } } privatestatic Builder create() { returnnew Builder(); } public Builder clear() { super.clear(); subReqID_ = 0; bitField0_ = (bitField0_ & ~0x00000001); respCode_ = 0; bitField0_ = (bitField0_ & ~0x00000002); desc_ = ""; bitField0_ = (bitField0_ & ~0x00000004); returnthis; } public Builder clone() { return create().mergeFrom(buildPartial()); } public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { return object.server.impl.SubScriptRespProto.internal_static_netty_SubScriptResp_descriptor; } public object.server.impl.SubScriptRespProto.SubScriptResp getDefaultInstanceForType() { return object.server.impl.SubScriptRespProto.SubScriptResp.getDefaultInstance(); } public object.server.impl.SubScriptRespProto.SubScriptResp build() { object.server.impl.SubScriptRespProto.SubScriptResp result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } public object.server.impl.SubScriptRespProto.SubScriptResp buildPartial() { object.server.impl.SubScriptRespProto.SubScriptResp result = new object.server.impl.SubScriptRespProto.SubScriptResp(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } result.subReqID_ = subReqID_; if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } result.respCode_ = respCode_; if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } result.desc_ = desc_; result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { if (other instanceof object.server.impl.SubScriptRespProto.SubScriptResp) { return mergeFrom((object.server.impl.SubScriptRespProto.SubScriptResp)other); } else { super.mergeFrom(other); returnthis; } } public Builder mergeFrom(object.server.impl.SubScriptRespProto.SubScriptResp other) { if (other == object.server.impl.SubScriptRespProto.SubScriptResp.getDefaultInstance()) returnthis; if (other.hasSubReqID()) { setSubReqID(other.getSubReqID()); } if (other.hasRespCode()) { setRespCode(other.getRespCode()); } if (other.hasDesc()) { bitField0_ |= 0x00000004; desc_ = other.desc_; onChanged(); } this.mergeUnknownFields(other.getUnknownFields()); returnthis; } publicfinalboolean isInitialized() { if (!hasSubReqID()) { returnfalse; } if (!hasRespCode()) { returnfalse; } if (!hasDesc()) { returnfalse; } returntrue; } public Builder mergeFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { object.server.impl.SubScriptRespProto.SubScriptResp parsedMessage = null; try { parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry); } catch (com.google.protobuf.InvalidProtocolBufferException e) { parsedMessage = (object.server.impl.SubScriptRespProto.SubScriptResp) e.getUnfinishedMessage(); throw e; } finally { if (parsedMessage != null) { mergeFrom(parsedMessage); } } returnthis; } privateint bitField0_; // required int32 subReqID = 1;privateint subReqID_ ; /** * <code>required int32 subReqID = 1;</code> */publicboolean hasSubReqID() { return ((bitField0_ & 0x00000001) == 0x00000001); } /** * <code>required int32 subReqID = 1;</code> */publicint getSubReqID() { return subReqID_; } /** * <code>required int32 subReqID = 1;</code> */public Builder setSubReqID(int value) { bitField0_ |= 0x00000001; subReqID_ = value; onChanged(); returnthis; } /** * <code>required int32 subReqID = 1;</code> */public Builder clearSubReqID() { bitField0_ = (bitField0_ & ~0x00000001); subReqID_ = 0; onChanged(); returnthis; } // required int32 respCode = 2;privateint respCode_ ; /** * <code>required int32 respCode = 2;</code> */publicboolean hasRespCode() { return ((bitField0_ & 0x00000002) == 0x00000002); } /** * <code>required int32 respCode = 2;</code> */publicint getRespCode() { return respCode_; } /** * <code>required int32 respCode = 2;</code> */public Builder setRespCode(int value) { bitField0_ |= 0x00000002; respCode_ = value; onChanged(); returnthis; } /** * <code>required int32 respCode = 2;</code> */public Builder clearRespCode() { bitField0_ = (bitField0_ & ~0x00000002); respCode_ = 0; onChanged(); returnthis; } // required string desc = 3;private java.lang.Object desc_ = ""; /** * <code>required string desc = 3;</code> */publicboolean hasDesc() { return ((bitField0_ & 0x00000004) == 0x00000004); } /** * <code>required string desc = 3;</code> */public java.lang.String getDesc() { java.lang.Object ref = desc_; if (!(ref instanceof java.lang.String)) { java.lang.String s = ((com.google.protobuf.ByteString) ref) .toStringUtf8(); desc_ = s; return s; } else { return (java.lang.String) ref; } } /** * <code>required string desc = 3;</code> */public com.google.protobuf.ByteString getDescBytes() { java.lang.Object ref = desc_; if (ref instanceof String) { com.google.protobuf.ByteString b = com.google.protobuf.ByteString.copyFromUtf8( (java.lang.String) ref); desc_ = b; return b; } else { return (com.google.protobuf.ByteString) ref; } } /** * <code>required string desc = 3;</code> */public Builder setDesc( java.lang.String value) { if (value == null) { thrownew NullPointerException(); } bitField0_ |= 0x00000004; desc_ = value; onChanged(); returnthis; } /** * <code>required string desc = 3;</code> */public Builder clearDesc() { bitField0_ = (bitField0_ & ~0x00000004); desc_ = getDefaultInstance().getDesc(); onChanged(); returnthis; } /** * <code>required string desc = 3;</code> */public Builder setDescBytes( com.google.protobuf.ByteString value) { if (value == null) { thrownew NullPointerException(); } bitField0_ |= 0x00000004; desc_ = value; onChanged(); returnthis; } // @@protoc_insertion_point(builder_scope:netty.SubScriptResp) } static { defaultInstance = new SubScriptResp(true); defaultInstance.initFields(); } // @@protoc_insertion_point(class_scope:netty.SubScriptResp) } privatestatic com.google.protobuf.Descriptors.Descriptor internal_static_netty_SubScriptResp_descriptor; privatestatic com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_netty_SubScriptResp_fieldAccessorTable; publicstatic com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { return descriptor; } privatestatic com.google.protobuf.Descriptors.FileDescriptor descriptor; static { java.lang.String[] descriptorData = { "\n\031netty/SubScriptResp.proto\022\005netty\"A\n\rSu" + "bScriptResp\022\020\n\010subReqID\030\001 \002(\005\022\020\n\010respCod" + "e\030\002 \002(\005\022\014\n\004desc\030\003 \002(\tB(\n\022object.server.i" + "mplB\022SubScriptRespProto" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; internal_static_netty_SubScriptResp_descriptor = getDescriptor().getMessageTypes().get(0); internal_static_netty_SubScriptResp_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_netty_SubScriptResp_descriptor, new java.lang.String[] { "SubReqID", "RespCode", "Desc", }); returnnull; } }; com.google.protobuf.Descriptors.FileDescriptor .internalBuildGeneratedFileFrom(descriptorData, new com.google.protobuf.Descriptors.FileDescriptor[] { }, assigner); } // @@protoc_insertion_point(outer_class_scope) }
2.3 测试
package protobuf.client.impl; import object.server.impl.SubScriptReqProto; import object.server.impl.SubScriptReqProto.SubScriptReq; import com.google.protobuf.InvalidProtocolBufferException; public class TestReqProto { public static void main(String[] args) throws InvalidProtocolBufferException { SubScriptReqProto.SubScriptReq.Builder builder = SubScriptReqProto.SubScriptReq .newBuilder(); builder.setSubReqID(1); builder.setUserName("leifeng"); builder.setProductName("netty book !!!"); builder.setAddress("add1"); SubScriptReq req = builder.build(); System.out.println(req); SubScriptReqProto.SubScriptReq requiem = decode(encode(req)); System.out.println(requiem); System.out.println(req.equals(requiem)); } privatestatic SubScriptReq decode(byte[] encode) throws InvalidProtocolBufferException { // TODO Auto-generated method stubreturn SubScriptReqProto.SubScriptReq.parseFrom(encode); } privatestaticbyte[] encode(SubScriptReq builder) { return builder.toByteArray(); } }
原文:http://www.cnblogs.com/mjorcen/p/4545109.html
内容总结
以上是互联网集市为您收集整理的Google Protobuf 使用 Java 版全部内容,希望文章能够帮你解决Google Protobuf 使用 Java 版所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。