[protobuf] Re: A bit more protobuf help please

2011-10-11 Thread Dale Durham
Thanks again for all your help Benjamin!!! I just got it all working and would still probably be tinkering without your help. Dale On Oct 11, 9:52 am, Dale Durham wrote: > Never mind, I figured it out. My descriptor files are named > differently. So when the dependency list is passed, I get xxx.

[protobuf] Re: A bit more protobuf help please

2011-10-11 Thread Benjamin Wright
Dale - sounds like you figured it out, but the quick answer anyway (for anyone else listening...) The code I provided expects that the Descriptor files you have are created with the "--include_imports" directive provided to protoc... which means that all the imported files will be included in the

[protobuf] Re: A bit more protobuf help please

2011-10-11 Thread Dale Durham
Never mind, I figured it out. My descriptor files are named differently. So when the dependency list is passed, I get xxx.proto and the file that I really want is xxx.desc. I guess I'll have to parse the extension out, change it then put the correct ones into fdl. Dale On Oct 11, 9:36 am, Dale Du

[protobuf] Re: A bit more protobuf help please

2011-10-11 Thread Dale Durham
I get that (kind of), but in the sample you posted, when the call to "FileDescriptor fddd = fdl.get(dependencyList.get(i));" is made the is nothing in fdl because nothing was ever "put" onto it at that point. So like said either I am missing something or there is a step missing here... final FileD

[protobuf] Re: A bit more protobuf help please

2011-10-10 Thread Benjamin Wright
Let's say you have message Card in file deck.proto Descriptor card = fdl.get("deck.proto").findMessage("Card"); DynamicMessage.parse (bytes, card) On Oct 10, 3:50 pm, Dale Durham wrote: > OK, I think I may have missed a step here. Right now, I have: > > 1) A file stream with the top level

[protobuf] Re: A bit more protobuf help please

2011-10-10 Thread Dale Durham
OK, I think I may have missed a step here. Right now, I have: 1) A file stream with the top level message descriptor - fds 2) A hash map with all the dependency descriptors - fdl final FileDescriptorSet fds = FileDescriptorSet.parseFrom(new FileInputStream(myFile)); // load the file however you f

[protobuf] Re: A bit more protobuf help please

2011-10-10 Thread Benjamin Wright
You just need the descriptor for the top level message. It has the links back to all the Contained types. That is why you needed the descriptors of all of all the dependent files in order to build the file descriptor. On Oct 10, 2:37 pm, Dale Durham wrote: > Hi Benjamin, > > Thanks again, I thi

[protobuf] Re: A bit more protobuf help please

2011-10-10 Thread Dale Durham
Hi Benjamin, Thanks again, I think that am very close now. I have the hash map with all the descriptors in it and I see that DynamicMessage has a parseFrom method that takes (Descriptor type, Byte[] data). So I can pass my messages byte stream in as the data, but cannot quite figure out what to pa

[protobuf] Re: A bit more protobuf help please

2011-10-10 Thread Benjamin Wright
PS.. Just in case it want clear you should not need protoc for anything after you have the descriptors. The Java protobuf library can do all the dynamic parsing logic for you. On Oct 10, 11:03 am, Benjamin Wright wrote: > Dale: > > I'm glad to be of help.  You're definitely over thinking the pro

[protobuf] Re: A bit more protobuf help please

2011-10-10 Thread Benjamin Wright
Dale: I'm glad to be of help. You're definitely over thinking the problem. File descriptor set- a protobuf describing one put more proto files. Contains file descriptor proto (s) File descriptor proto- a protobuf describing a Single proto file File descriptor-a java class containing the descri