Greetings Everyone,
I spent a few days on trying to understand how to learn de-serializing
information without invoking the necessary java classes.
This is what I receive
message myMsg {
required string name=1;
required bytes data=2;
}
data could have been serialized by one of these:
a.proto
b.proto
c.proto
and those proto files depend on
enum.proto.
I know the name within the message tells me which proto files is used to
serialize the information which is the data field in the message. My goal
is to use the "descriptor" of that proto file and de-serialize that
information in the data field dynamically.
I did do some reading like:
http://stackoverflow.com/questions/18836727/protocol-buffer-objects-generated-at-runtime
https://developers.google.com/protocol-buffers/docs/techniques#self-description
the most helpful link was:
http://planet.jboss.org/post/generic_marshalling_with_google_protocol_buffers
which i did follow and i compiled the necessary proto files with
--include_imports because they rely on a enum.proto file and
--descriptor_set_out
Now I have additionally:a.desc, b.desc, c.desc ,enum.desc
How do I make use of those .desc files to de-serialize the data within
myMsg. My gut feeling says I need to make use of the
dynamicMessage parseFrom( Descriptors.Descriptor type, byte[] data) as
desrcibed here
(https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/DynamicMessage)
Any simple example that I can follow would be appreciated.
thank you
Can
--
You received this message because you are subscribed to the Google Groups
"Protocol Buffers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/protobuf.
For more options, visit https://groups.google.com/d/optout.