encodeToString

@JvmStatic
fun ByteArray.encodeToString(encoder: Encoder<*>): String(source)

Encodes a ByteArray for the provided encoder and returns the encoded data in the form of a String.

Throws

if the encoded output exceeds Int.MAX_VALUE. This is not applicable for most encoding specifications as the majority compress data, but is something that can occur with Base16 (hex) as it produces 2 characters of output for every 1 byte of input.