Java: Pack/Unpack Protocol Buffers Messages
Java: Pack/Unpack Protocol Buffers Messages avatar

Here is also a full example for handling Protocol Buffers messages with nested Any messages:

ProtocolBuffers Files

A simple Protocol Buffers file with a nested Any message could look like:

A possible nested message could then be:

Packing

To build the full message the following function can be used:

Unpacking

To read the child message from the parent message the following function can be used: