草庐IT

PictureProtoBuf

全部标签

java - 使用 Protocol Buffers 和内部数据模型

我有一个图片的现有内部数据模型,如下所示:packagetest.model;publicclassPicture{privateintheight,width;privateFormatformat;publicenumFormat{JPEG,BMP,GIF}//Constructor,gettersandsetters,hashCode,equals,toStringetc.}我现在想使用protocolbuffers序列化它.我写了一个Picture.proto文件,它反射(reflect)了Picture类的字段,并在test.model.protobuf包下编译了代码,类名是