4 ms·
The tags and wire types are encoded in the payload. For each tag you can determine how many bytes are used either because it’s a fixed size data type (float, d
by sandermvanvliet 5y ago
The tags and wire types are encoded in the payload.
For each tag you can determine how many bytes are used either because it’s a fixed size data type (float, double), length-delimited (strings, embedded messages) that include the byte size or it’s a varint where we can scan to the last byte of the encoded number.
It’s true that this doesn’t tell you everything, you don’t know if there are optional tags in the interface that just don’t appear in the payload. But that’s fine, the goal is to provide insight into the payload, not to generate the absolute correct interface.
Future plans are to include some analysis of the tag values especially for length-delimited tags to better detect strings for example
- avinassh 5y agoGot it, thank you for explaining!
- sandermvanvliet 5y agoYou’re welcome. If you want to see how it works you can check the code on github and the relevant unit tests