java float 不能序列化_java之序列化与反序列化

public final classUsrProto {privateUsrProto() {}public static voidregisterAllExtensions(

com.google.protobuf.ExtensionRegistry registry) {

}public interface UsrOrBuilder extends

//@@protoc_insertion_point(interface_extends:Usr)

com.google.protobuf.MessageOrBuilder {/*** required string id = 1;*/

booleanhasId();/*** required string id = 1;*/String getId();/*** required string id = 1;*/com.google.protobuf.ByteString

getIdBytes();/*** required string name = 2;*/

booleanhasName();/*** required string name = 2;*/String getName();/*** required string name = 2;*/com.google.protobuf.ByteString

getNameBytes();/*** required string age = 3;*/

booleanhasAge();/*** required string age = 3;*/String getAge();/*** required string age = 3;*/com.google.protobuf.ByteString

getAgeBytes();

}/*** Protobuf type {@codeUsr}*/

public static final class Usr extendscom.google.protobuf.GeneratedMessageimplements

//@@protoc_insertion_point(message_implements:Usr)

UsrOrBuilder {//Use Usr.newBuilder() to construct.

privateUsr(com.google.protobuf.GeneratedMessage.Builder builder) {super(builder);

}privateUsr() {

id_= "";

name_= "";

age_= "";

}

@Overridepublic finalcom.google.protobuf.UnknownFieldSet

getUnknownFields() {return this.unknownFields;

}privateUsr(

com.google.protobuf.CodedInputStream input,

com.google.protobuf.ExtensionRegistryLite extensionRegistry)throwscom.google.protobuf.InvalidProtocolBufferException {this();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 10: {

com.google.protobuf.ByteString bs=input.readBytes();

bitField0_|= 0x00000001;

id_=bs;break;

}case 18: {

com.google.protobuf.ByteString bs=input.readBytes();

bitField0_|= 0x00000002;

name_=bs;break;

}case 26: {

com.google.protobuf.ByteString bs=input.readBytes();

bitField0_|= 0x00000004;

age_=bs;break;

}

}

}

}catch(com.google.protobuf.InvalidProtocolBufferException e) {throw e.setUnfinishedMessage(this);

}catch(java.io.IOException e) {throw newcom.google.protobuf.InvalidProtocolBufferException(

e.getMessage()).setUnfinishedMessage(this);

}finally{this.unknownFields =unknownFields.build();

makeExtensionsImmutable();

}

}public static finalcom.google.protobuf.Descriptors.Descriptor

getDescriptor() {returnUsrProto.internal_static_Usr_descriptor;

}protectedFieldAccessorTable

internalGetFieldAccessorTable() {returnUsrProto.internal_static_Usr_fieldAccessorTable

.ensureFieldAccessorsInitialized(

Usr.class, Builder.class);

}public static final com.google.protobuf.Parser PARSER =

new com.google.protobuf.AbstractParser() {publicUsr parsePartialFrom(

com.google.protobuf.CodedInputStream input,

com.google.protobuf.ExtensionRegistryLite extensionRegistry)throwscom.google.protobuf.InvalidProtocolBufferException {return newUsr(input, extensionRegistry);

}

};

@Overridepublic com.google.protobuf.ParsergetParserForType() {returnPARSER;

}private intbitField0_;public static final int ID_FIELD_NUMBER = 1;privateObject id_;/*** required string id = 1;*/

public booleanhasId() {return ((bitField0_ & 0x00000001) == 0x00000001);

}/*** required string id = 1;*/

publicString getId() {

Object ref=id_;if (ref instanceofString) {return(String) ref;

}else{

com.google.protobuf.ByteString bs=(com.google.protobuf.ByteString) ref;

String s=bs.toStringUtf8();if(bs.isValidUtf8()) {

id_=s;

}returns;

}

}/*** required string id = 1;*/

publiccom.google.protobuf.ByteString

getIdBytes() {

Object ref=id_;if (ref instanceofString) {

com.google.protobuf.ByteString b=com.google.protobuf.ByteString.copyFromUtf8(

(String) ref);

id_=b;returnb;

}else{return(com.google.protobuf.ByteString) ref;

}

}public static final int NAME_FIELD_NUMBER = 2;privateObject name_;/*** required string name = 2;*/

public booleanhasName() {return ((bitField0_ & 0x00000002) == 0x00000002);

}/*** required string name = 2;*/

publicString getName() {

Object ref=name_;if (ref instanceofString) {return(String) ref;

}else{

com.google.protobuf.ByteString bs=(com.google.protobuf.ByteString) ref;

String s=bs.toStringUtf8();if(bs.isValidUtf8()) {

name_=s;

}returns;

}

}/*** required string name = 2;*/

publiccom.google.protobuf.ByteString

getNameBytes() {

Object ref=name_;if (ref instanceofString) {

com.google.protobuf.ByteString b=com.google.protobuf.ByteString.copyFromUtf8(

(String) ref);

name_=b;returnb;

}else{return(com.google.protobuf.ByteString) ref;

}

}public static final int AGE_FIELD_NUMBER = 3;privateObject age_;/*** required string age = 3;*/

public booleanhasAge() {return ((bitField0_ & 0x00000004) == 0x00000004);

}/*** required string age = 3;*/

publicString getAge() {

Object ref=age_;if (ref instanceofString) {return(String) ref;

}else{

com.google.protobuf.ByteString bs=(com.google.protobuf.ByteString) ref;

String s=bs.toStringUtf8();if(bs.isValidUtf8()) {

age_=s;

}returns;

}

}/*** required string age = 3;*/

publiccom.google.protobuf.ByteString

getAgeBytes() {

Object ref=age_;if (ref instanceofString) {

com.google.protobuf.ByteString b=com.google.protobuf.ByteString.copyFromUtf8(

(String) ref);

age_=b;returnb;

}else{return(com.google.protobuf.ByteString) ref;

}

}private byte memoizedIsInitialized = -1;public final booleanisInitialized() {byte isInitialized =memoizedIsInitialized;if (isInitialized == 1) return true;if (isInitialized == 0) return false;if (!hasId()) {

memoizedIsInitialized= 0;return false;

}if (!hasName()) {

memoizedIsInitialized= 0;return false;

}if (!hasAge()) {

memoizedIsInitialized= 0;return false;

}

memoizedIsInitialized= 1;return true;

}public voidwriteTo(com.google.protobuf.CodedOutputStream output)throwsjava.io.IOException {

getSerializedSize();if (((bitField0_ & 0x00000001) == 0x00000001)) {

output.writeBytes(1, getIdBytes());

}if (((bitField0_ & 0x00000002) == 0x00000002)) {

output.writeBytes(2, getNameBytes());

}if (((bitField0_ & 0x00000004) == 0x00000004)) {

output.writeBytes(3, getAgeBytes());

}

unknownFields.writeTo(output);

}private int memoizedSerializedSize = -1;public intgetSerializedSize() {int size =memoizedSerializedSize;if (size != -1) returnsize;

size= 0;if (((bitField0_ & 0x00000001) == 0x00000001)) {

size+=com.google.protobuf.CodedOutputStream

.computeBytesSize(1, getIdBytes());

}if (((bitField0_ & 0x00000002) == 0x00000002)) {

size+=com.google.protobuf.CodedOutputStream

.computeBytesSize(2, getNameBytes());

}if (((bitField0_ & 0x00000004) == 0x00000004)) {

size+=com.google.protobuf.CodedOutputStream

.computeBytesSize(3, getAgeBytes());

}

size+=unknownFields.getSerializedSize();

memoizedSerializedSize=size;returnsize;

}private static final long serialVersionUID = 0L;public staticUsr parseFrom(

com.google.protobuf.ByteString data)throwscom.google.protobuf.InvalidProtocolBufferException {returnPARSER.parseFrom(data);

}public staticUsr parseFrom(

com.google.protobuf.ByteString data,

com.google.protobuf.ExtensionRegistryLite extensionRegistry)throwscom.google.protobuf.InvalidProtocolBufferException {returnPARSER.parseFrom(data, extensionRegistry);

}public static Usr parseFrom(byte[] data)throwscom.google.protobuf.InvalidProtocolBufferException {returnPARSER.parseFrom(data);

}public staticUsr parseFrom(byte[] data,

com.google.protobuf.ExtensionRegistryLite extensionRegistry)throwscom.google.protobuf.InvalidProtocolBufferException {returnPARSER.parseFrom(data, extensionRegistry);

}public staticUsr parseFrom(java.io.InputStream input)throwsjava.io.IOException {returnPARSER.parseFrom(input);

}public staticUsr parseFrom(

java.io.InputStream input,

com.google.protobuf.ExtensionRegistryLite extensionRegistry)throwsjava.io.IOException {returnPARSER.parseFrom(input, extensionRegistry);

}public staticUsr parseDelimitedFrom(java.io.InputStream input)throwsjava.io.IOException {returnPARSER.parseDelimitedFrom(input);

}public staticUsr parseDelimitedFrom(

java.io.InputStream input,

com.google.protobuf.ExtensionRegistryLite extensionRegistry)throwsjava.io.IOException {returnPARSER.parseDelimitedFrom(input, extensionRegistry);

}public staticUsr parseFrom(

com.google.protobuf.CodedInputStream input)throwsjava.io.IOException {returnPARSER.parseFrom(input);

}public staticUsr parseFrom(

com.google.protobuf.CodedInputStream input,

com.google.protobuf.ExtensionRegistryLite extensionRegistry)throwsjava.io.IOException {returnPARSER.parseFrom(input, extensionRegistry);

}public static Builder newBuilder() { return newBuilder(); }public Builder newBuilderForType() { returnnewBuilder(); }public staticBuilder newBuilder(Usr prototype) {returnnewBuilder().mergeFrom(prototype);

}public Builder toBuilder() { return newBuilder(this); }

@OverrideprotectedBuilder newBuilderForType(

BuilderParent parent) {

Builder builder= newBuilder(parent);returnbuilder;

}/*** Protobuf type {@codeUsr}*/

public static final class Builder extendscom.google.protobuf.GeneratedMessage.Builder implements

//@@protoc_insertion_point(builder_implements:Usr)

UsrOrBuilder {public static finalcom.google.protobuf.Descriptors.Descriptor

getDescriptor() {returnUsrProto.internal_static_Usr_descriptor;

}protectedFieldAccessorTable

internalGetFieldAccessorTable() {returnUsrProto.internal_static_Usr_fieldAccessorTable

.ensureFieldAccessorsInitialized(

Usr.class, Builder.class);

}//Construct using com.troy.application.proto.UsrProto.Usr.newBuilder()

privateBuilder() {

maybeForceBuilderInitialization();

}privateBuilder(

BuilderParent parent) {super(parent);

maybeForceBuilderInitialization();

}private voidmaybeForceBuilderInitialization() {if(com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) {

}

}publicBuilder clear() {super.clear();

id_= "";

bitField0_= (bitField0_ & ~0x00000001);

name_= "";

bitField0_= (bitField0_ & ~0x00000002);

age_= "";

bitField0_= (bitField0_ & ~0x00000004);return this;

}publiccom.google.protobuf.Descriptors.Descriptor

getDescriptorForType() {returnUsrProto.internal_static_Usr_descriptor;

}publicUsr getDefaultInstanceForType() {returnUsr.getDefaultInstance();

}publicUsr build() {

Usr result=buildPartial();if (!result.isInitialized()) {thrownewUninitializedMessageException(result);

}returnresult;

}publicUsr buildPartial() {

Usr result= new Usr(this);int from_bitField0_ =bitField0_;int to_bitField0_ = 0;if (((from_bitField0_ & 0x00000001) == 0x00000001)) {

to_bitField0_|= 0x00000001;

}

result.id_=id_;if (((from_bitField0_ & 0x00000002) == 0x00000002)) {

to_bitField0_|= 0x00000002;

}

result.name_=name_;if (((from_bitField0_ & 0x00000004) == 0x00000004)) {

to_bitField0_|= 0x00000004;

}

result.age_=age_;

result.bitField0_=to_bitField0_;

onBuilt();returnresult;

}publicBuilder mergeFrom(com.google.protobuf.Message other) {if (other instanceofUsr) {returnmergeFrom((Usr)other);

}else{super.mergeFrom(other);return this;

}

}publicBuilder mergeFrom(Usr other) {if (other == Usr.getDefaultInstance()) return this;if(other.hasId()) {

bitField0_|= 0x00000001;

id_=other.id_;

onChanged();

}if(other.hasName()) {

bitField0_|= 0x00000002;

name_=other.name_;

onChanged();

}if(other.hasAge()) {

bitField0_|= 0x00000004;

age_=other.age_;

onChanged();

}this.mergeUnknownFields(other.unknownFields);

onChanged();return this;

}public final booleanisInitialized() {if (!hasId()) {return false;

}if (!hasName()) {return false;

}if (!hasAge()) {return false;

}return true;

}publicBuilder mergeFrom(

com.google.protobuf.CodedInputStream input,

com.google.protobuf.ExtensionRegistryLite extensionRegistry)throwsjava.io.IOException {

Usr parsedMessage= null;try{

parsedMessage=PARSER.parsePartialFrom(input, extensionRegistry);

}catch(com.google.protobuf.InvalidProtocolBufferException e) {

parsedMessage=(Usr) e.getUnfinishedMessage();throwe;

}finally{if (parsedMessage != null) {

mergeFrom(parsedMessage);

}

}return this;

}private intbitField0_;private Object id_ = "";/*** required string id = 1;*/

public booleanhasId() {return ((bitField0_ & 0x00000001) == 0x00000001);

}/*** required string id = 1;*/

publicString getId() {

Object ref=id_;if (!(ref instanceofString)) {

com.google.protobuf.ByteString bs=(com.google.protobuf.ByteString) ref;

String s=bs.toStringUtf8();if(bs.isValidUtf8()) {

id_=s;

}returns;

}else{return(String) ref;

}

}/*** required string id = 1;*/

publiccom.google.protobuf.ByteString

getIdBytes() {

Object ref=id_;if (ref instanceofString) {

com.google.protobuf.ByteString b=com.google.protobuf.ByteString.copyFromUtf8(

(String) ref);

id_=b;returnb;

}else{return(com.google.protobuf.ByteString) ref;

}

}/*** required string id = 1;*/

publicBuilder setId(

String value) {if (value == null) {throw newNullPointerException();

}

bitField0_|= 0x00000001;

id_=value;

onChanged();return this;

}/*** required string id = 1;*/

publicBuilder clearId() {

bitField0_= (bitField0_ & ~0x00000001);

id_=getDefaultInstance().getId();

onChanged();return this;

}/*** required string id = 1;*/

publicBuilder setIdBytes(

com.google.protobuf.ByteString value) {if (value == null) {throw newNullPointerException();

}

bitField0_|= 0x00000001;

id_=value;

onChanged();return this;

}private Object name_ = "";/*** required string name = 2;*/

public booleanhasName() {return ((bitField0_ & 0x00000002) == 0x00000002);

}/*** required string name = 2;*/

publicString getName() {

Object ref=name_;if (!(ref instanceofString)) {

com.google.protobuf.ByteString bs=(com.google.protobuf.ByteString) ref;

String s=bs.toStringUtf8();if(bs.isValidUtf8()) {

name_=s;

}returns;

}else{return(String) ref;

}

}/*** required string name = 2;*/

publiccom.google.protobuf.ByteString

getNameBytes() {

Object ref=name_;if (ref instanceofString) {

com.google.protobuf.ByteString b=com.google.protobuf.ByteString.copyFromUtf8(

(String) ref);

name_=b;returnb;

}else{return(com.google.protobuf.ByteString) ref;

}

}/*** required string name = 2;*/

publicBuilder setName(

String value) {if (value == null) {throw newNullPointerException();

}

bitField0_|= 0x00000002;

name_=value;

onChanged();return this;

}/*** required string name = 2;*/

publicBuilder clearName() {

bitField0_= (bitField0_ & ~0x00000002);

name_=getDefaultInstance().getName();

onChanged();return this;

}/*** required string name = 2;*/

publicBuilder setNameBytes(

com.google.protobuf.ByteString value) {if (value == null) {throw newNullPointerException();

}

bitField0_|= 0x00000002;

name_=value;

onChanged();return this;

}private Object age_ = "";/*** required string age = 3;*/

public booleanhasAge() {return ((bitField0_ & 0x00000004) == 0x00000004);

}/*** required string age = 3;*/

publicString getAge() {

Object ref=age_;if (!(ref instanceofString)) {

com.google.protobuf.ByteString bs=(com.google.protobuf.ByteString) ref;

String s=bs.toStringUtf8();if(bs.isValidUtf8()) {

age_=s;

}returns;

}else{return(String) ref;

}

}/*** required string age = 3;*/

publiccom.google.protobuf.ByteString

getAgeBytes() {

Object ref=age_;if (ref instanceofString) {

com.google.protobuf.ByteString b=com.google.protobuf.ByteString.copyFromUtf8(

(String) ref);

age_=b;returnb;

}else{return(com.google.protobuf.ByteString) ref;

}

}/*** required string age = 3;*/

publicBuilder setAge(

String value) {if (value == null) {throw newNullPointerException();

}

bitField0_|= 0x00000004;

age_=value;

onChanged();return this;

}/*** required string age = 3;*/

publicBuilder clearAge() {

bitField0_= (bitField0_ & ~0x00000004);

age_=getDefaultInstance().getAge();

onChanged();return this;

}/*** required string age = 3;*/

publicBuilder setAgeBytes(

com.google.protobuf.ByteString value) {if (value == null) {throw newNullPointerException();

}

bitField0_|= 0x00000004;

age_=value;

onChanged();return this;

}//@@protoc_insertion_point(builder_scope:Usr)

}//@@protoc_insertion_point(class_scope:Usr)

private static final Usr defaultInstance;static{

defaultInstance= newUsr();

}public staticUsr getDefaultInstance() {returndefaultInstance;

}publicUsr getDefaultInstanceForType() {returndefaultInstance;

}

}private static finalcom.google.protobuf.Descriptors.Descriptor

internal_static_Usr_descriptor;private staticcom.google.protobuf.GeneratedMessage.FieldAccessorTable

internal_static_Usr_fieldAccessorTable;public staticcom.google.protobuf.Descriptors.FileDescriptor

getDescriptor() {returndescriptor;

}private staticcom.google.protobuf.Descriptors.FileDescriptor

descriptor;static{

String[] descriptorData={"\n\nuser.proto\",\n\003Usr\022\n\n\002id\030\001 \002(\t\022\014\n\004name\030" +

"\002 \002(\t\022\013\n\003age\030\003 \002(\tB&\n\032com.troy.applicati" +

"on.protoB\010UsrProto"};

com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner=

newcom.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {publiccom.google.protobuf.ExtensionRegistry assignDescriptors(

com.google.protobuf.Descriptors.FileDescriptor root) {

descriptor=root;return null;

}

};

com.google.protobuf.Descriptors.FileDescriptor

.internalBuildGeneratedFileFrom(descriptorData,newcom.google.protobuf.Descriptors.FileDescriptor[] {

}, assigner);

internal_static_Usr_descriptor=getDescriptor().getMessageTypes().get(0);

internal_static_Usr_fieldAccessorTable= newcom.google.protobuf.GeneratedMessage.FieldAccessorTable(

internal_static_Usr_descriptor,new String[] { "Id", "Name", "Age", });

}//@@protoc_insertion_point(outer_class_scope)

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值