this seems to act strangely, whether I use the CodedOutputStream or
OutputStream approach. It kinda seems like the message.writeTo() kinda
moves to the start of the stream and writes there, rather than writing
continuously.
2008/7/8 Kenton Varda <ken...@google.com>:
--
James
-------
http://macstrac.blogspot.com/
Open Source Integration
http://open.iona.com
when writing a number of messages....
CodedOutputStream cout = CodedOutputStream.newInstance(out);
...
// in some loop...
int size = message.getSerializedSize();
cout.writeRawVarint32(size);
message.writeTo(cout);
then reading them...
CodedInputStream cin = CodedInputStream.newInstance(in);
...
// in some loop...
int size = cin.readRawVarint32();
int previous = cin.pushLimit(size);
message = Foo.Bar.parseFrom(cin);
cin.popLimit(previous);
it was the use of pushLimit() / popLimit() that took a little while to
figure out.
Am really liking Protocol Buffers - good stuff! :)
2008/7/8 James Strachan <james.s...@gmail.com>: