[protobuf] Re: Retrieving data with field number and wire type

2009-11-10 Thread Evan Jones

On Nov 10, 2009, at 9:25 , rahul prasad wrote:
 Is there a facility in protobuf library to retrieve data if the  
 field numbers and wire types are known? If so how to go about this?

If you don't want to use the generated code that handles this for you  
for some reason, you want to look at CodedInputStream

C++:
http://code.google.com/apis/protocolbuffers/docs/reference/cpp/google.protobuf.io.coded_stream.html

Java:
http://code.google.com/apis/protocolbuffers/docs/reference/java/index.html?com/google/protobuf/CodedInputStream.html

--
Evan Jones
http://evanjones.ca/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---



[protobuf] Re: Retrieving data with field number and wire type

2009-11-10 Thread Kenton Varda
On Tue, Nov 10, 2009 at 6:25 AM, rahul prasad rahu...@gmail.com wrote:

 Hi,

 Is there a facility in protobuf library to retrieve data if the field
 numbers and wire types are known?


Write a .proto file with that information.  Then you can compile it, or you
can use protoc's --decode flag.

If you need something automated that runs as part of a larger app, you can
construct a FileDescriptorProto at run-time, which is a structured
representation of the contents of a .proto file.  You can then convert that
to a FileDescriptor using DescriptorPool (C++) or
Descriptors.FileDescriptor.buildFrom() (Java), and then construct a
DynamicMessage from the descriptors (either language).

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
Protocol Buffers group.
To post to this group, send email to protobuf@googlegroups.com
To unsubscribe from this group, send email to 
protobuf+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/protobuf?hl=en
-~--~~~~--~~--~--~---