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.

Reply via email to