[protobuf] Deserialize messages from CodedInputStream without a message size prefix
Hello, I have a CodedInputStream created from a byte array (in C++) CodedInputStream cds((uint8_t*)a,tbytes); cds.SetTotalBytesLimit(N,M); I have written bytes to this array (a) from Java like so b.writeRawBytes(k.getBytes(),0,k.getLength()); b.writeRawBytes(v.getBytes(),0,v.getLength()); Given the number N of k,v pairs written, I'd like to deserialize them. Notice I haven't prepended byte sizes. I thought I could do something like this for(i = 1 to N){ rexp_container-ParseFromCodedStream(cds) //k // do something with rexp_container rexp_container.Clear(); rexp_container-ParseFromCodedStream(cds) //v // do something with rexp_container rexp_container.Clear(); } Is this the correct way to do it? I get a missing field error (not supposed to be the case) I tried ParsePartialFromCodedStream but I get incorrect results. Is it okay to provide a CodedInputStream and pick of the messages one by one? Cheers Joy [1] PB ERROR[LOGLEVEL_ERROR](google/protobuf/message_lite.cc:123) Can't parse message of type REXP because it is missing required fields: rclass -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@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] Allow protobuf-related job postings on this list?
Hi all, I received an e-mail from a recruiting company asking whether it would be OK to post a job listing on this mailing list. Apparently, they need someone experienced with protocol buffers. I was originally going to just say no, but on further thought I actually don't know what's appropriate. It is, after all, protobuf-related. I suppose it all depends on how you -- the list members -- feel. Should I allow it? (Obviously I would still reject non-protobuf-related solicitations.) Discuss. -Kenton -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@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.
RE: [protobuf] Allow protobuf-related job postings on this list?
I think this is a reasonable use of the list, particularly since you're moderating such posts. david dabbs From: protobuf@googlegroups.com [mailto:proto...@googlegroups.com] On Behalf Of Kenton Varda Sent: Monday, December 13, 2010 1:07 AM To: Protocol Buffers Subject: [protobuf] Allow protobuf-related job postings on this list? Hi all, I received an e-mail from a recruiting company asking whether it would be OK to post a job listing on this mailing list. Apparently, they need someone experienced with protocol buffers. I was originally going to just say no, but on further thought I actually don't know what's appropriate. It is, after all, protobuf-related. I suppose it all depends on how you -- the list members -- feel. Should I allow it? (Obviously I would still reject non-protobuf-related solicitations.) Discuss. -Kenton -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@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.
Re: [protobuf] Deserialize messages from CodedInputStream without a message size prefix
You should be using toByteArray(), not getBytes(), to serialize to the protobuf wire format. You also need to delimit the messages. Otherwise, the first ParseFromCodedStream call will consume as many bytes as are available in the byte array. On Sun, Dec 12, 2010 at 10:13 PM, Fishtank saptarshi.g...@gmail.com wrote: Hello, I have a CodedInputStream created from a byte array (in C++) CodedInputStream cds((uint8_t*)a,tbytes); cds.SetTotalBytesLimit(N,M); I have written bytes to this array (a) from Java like so b.writeRawBytes(k.getBytes(),0,k.getLength()); b.writeRawBytes(v.getBytes(),0,v.getLength()); Given the number N of k,v pairs written, I'd like to deserialize them. Notice I haven't prepended byte sizes. I thought I could do something like this for(i = 1 to N){ rexp_container-ParseFromCodedStream(cds) //k // do something with rexp_container rexp_container.Clear(); rexp_container-ParseFromCodedStream(cds) //v // do something with rexp_container rexp_container.Clear(); } Is this the correct way to do it? I get a missing field error (not supposed to be the case) I tried ParsePartialFromCodedStream but I get incorrect results. Is it okay to provide a CodedInputStream and pick of the messages one by one? Cheers Joy [1] PB ERROR[LOGLEVEL_ERROR](google/protobuf/message_lite.cc:123) Can't parse message of type REXP because it is missing required fields: rclass -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@googlegroups.com. To unsubscribe from this group, send email to protobuf+unsubscr...@googlegroups.comprotobuf%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/protobuf?hl=en. -- You received this message because you are subscribed to the Google Groups Protocol Buffers group. To post to this group, send email to proto...@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.