title: How to determine message type in protobuf so that I can use that type.parsefrom(byte[ ])
body: <p>I am trying to send protobuf data from cpp side to java side.</p>
  
  <p>I have multiple message types defined in .proto</p>
  
  <p>On Cpp side, I have enums for every message type and I am adding it to the buf output as follows:</p>
  
  <pre><code>uint8_t* __temp = (uint8_t*)(buf);
  *__temp++ = (type) &gt;&gt; 8;
  *__temp = (type) &amp; 0x00FF;
  </code></pre>
  
  <p>How do I get this 'type' that I have added to the buf, so that I can achieve something like </p>
  
  <pre><code>MessageType parseFrom(byte[] data);
  </code></pre>