Length From
Marks a String field whose byte length is determined by a preceding numeric field. The referenced field must exist, come before this field, and be a numeric type.
@ProtocolMessage
data class NamedRecord(
val nameLength: UShort,
@LengthFrom("nameLength") val name: String, // reads nameLength bytes as UTF-8
val value: Int,
)Content copied to clipboard
Parameters
field
The name of the preceding numeric field that holds the byte length.