encodeToCharArray

@JvmStatic
fun ByteArray.encodeToCharArray(encoder: Encoder<*>): CharArray(source)

Encode a ByteArray.

Return

The CharArray of encoded data.

Parameters

encoder

The Encoder to use.

See also

Throws

If the encoder is configured to reject something, such as UTF-8 byte to text transformations rejecting invalid byte sequences.

If EncoderDecoder.Config.encodeOutMaxSize throws an exception (i.e. output would exceed Int.MAX_VALUE).


@JvmStatic
fun ByteArray.encodeToCharArray(encoder: Encoder<*>, offset: Int, len: Int): CharArray(source)

Encode len number of bytes from the array, starting at index offset.

Return

The CharArray of encoded data.

Parameters

encoder

The Encoder to use.

offset

The index in the array to start at.

len

The number of bytes, starting at index offset.

See also

Throws

If the encoder is configured to reject something, such as UTF-8 byte to text transformations rejecting invalid byte sequences.

If EncoderDecoder.Config.encodeOutMaxSize throws an exception (i.e. output would exceed Int.MAX_VALUE).

IndexOutOfBoundsException

If offset or len are inappropriate.