sizeInBytes

fun <T : Message<T, *>> ProtoAdapter<T>.sizeInBytes(message: T): Int(source)

Get the estimated encoded size of a message in bytes.

This accounts for variable-length encoding and is more accurate than just using ByteArray.size(). Useful for size validation and logging.

Return

Size in bytes when encoded

Parameters

message

The message to measure