Why does CodedInputStream set stream position to end?

前端 未结 1 1028
生来不讨喜
生来不讨喜 2021-01-24 20:10

I\'m using protocol buffers 3 in c#. I\'m trying to bounce through a stream to find the start locations of each message, without actually Deserialising the messages. All message

相关标签:
1条回答
  • 2021-01-24 20:43

    This behaviour is due to CodedInputStream buffering the original stream as you can see in the source code. It is probably unsuitable for manually reading and seeking through a stream. An alternative is to use parts of Marc Gravell's source code for reading a varint, available here, and move though the raw stream directly.

    0 讨论(0)
提交回复
热议问题