decodeToByteArray

@JvmStatic
fun CharSequence.decodeToByteArray(decoder: Decoder<*>): ByteArray(source)

Decode a CharSequence.

Return

The array of decoded data.

Parameters

decoder

The Decoder to use.

See also

Throws

If decoding failed, such as the decoder rejecting an invalid character or sequence.

If the decoded output would exceed Int.MAX_VALUE.


@JvmStatic
fun CharSequence.decodeToByteArray(decoder: Decoder<*>, offset: Int, len: Int): ByteArray(source)

Decode len number of characters from the sequence, starting at index offset.

Return

The array of decoded data.

Parameters

decoder

The Decoder to use.

offset

The index in the sequence to start at.

len

the number of characters, starting at index offset.

See also

Throws

If decoding failed, such as the decoder rejecting an invalid character or sequence.

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

IndexOutOfBoundsException

If offset or len are inappropriate.


@JvmStatic
fun CharArray.decodeToByteArray(decoder: Decoder<*>): ByteArray(source)

Decode a CharArray.

Return

The array of decoded data.

Parameters

decoder

The Decoder to use.

See also

Throws

If decoding failed, such as the decoder rejecting an invalid character or sequence.

If the decoded output would exceed Int.MAX_VALUE.


@JvmStatic
fun CharArray.decodeToByteArray(decoder: Decoder<*>, offset: Int, len: Int): ByteArray(source)

Decode len number of characters from the array, starting at index offset.

Return

The array of decoded data.

Parameters

decoder

The Decoder to use.

offset

The index in the array to start at.

len

the number of characters, starting at index offset.

See also

Throws

If decoding failed, such as the decoder rejecting an invalid character or sequence.

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

IndexOutOfBoundsException

If offset or len are inappropriate.