Search code examples
javaprotocol-buffers

get protobuf over-the-wire size in bytes


is there a way in java to get the size of a protobuf in bytes? I know there exists the getSerializedSize function, but I don't know if thats an accurate representation of what gets sent over the wire. Is there a way to get that size?


Solution

  • I don't know if thats an accurate representation of what gets sent over the wire

    Serialization is converting the proto into bytes that are sent over the wire or stored in a file. The serialized size is the size in bytes. Yes, this is an accurate representation of what gets sent over the wire.