I use protocol buffers 3 in C #. I am trying to bounce through a stream to find the starting locations of each message, without actually deserialising the messages. All messages are written to the stream using WriteDelimitedTo .
Then I use this code to try moving from length markers:
_map = new List<int>(); _stream.Seek(0, SeekOrigin.Begin); var codedStream = new CodedInputStream(_stream); while (_stream.Position < _stream.Length) { var length = codedStream.ReadInt32(); _map.Add((int) _stream.Position); _stream.Seek(length, SeekOrigin.Current); }
However, the moment I do codedStream.ReadInt32() , the position of the stream is set to the end, not just the next byte after varint32.
c # protocol-buffers
Meirion Hughes Nov 16 '15 at 11:08 2015-11-16 11:08
source share