encodeToByteArray

inline fun <T> BinaryFormat.encodeToByteArray(value: T): ByteArray

Serializes and encodes the given value to byte array using serializer retrieved from the reified type parameter.

Throws

in case of any encoding-specific error

if the encoded input does not comply format's specification