decodeToByteString

fun Base64.decodeToByteString(source: CharSequence, startIndex: Int = 0, endIndex: Int = source.length): ByteString(source)

Decodes symbols from the specified source char sequence or its substring. Returns a ByteString containing the resulting bytes.

The symbols for decoding are not required to be padded. However, if there is a padding character present, the correct amount of padding character(s) must be present. The padding character '=' is interpreted as the end of the encoded byte data. Subsequent symbols are prohibited.

Return

a ByteArray with the resulting bytes.

Parameters

source

the char sequence to decode symbols from.

startIndex

the beginning (inclusive) of the substring to decode, 0 by default.

endIndex

the end (exclusive) of the substring to decode, length of the source by default.

Throws

when startIndex or endIndex is out of range of source indices.

when the symbols for decoding are padded incorrectly or there are extra symbols after the padding.


fun Base64.decodeToByteString(source: ByteArray, startIndex: Int = 0, endIndex: Int = source.size): ByteString(source)
fun Base64.decodeToByteString(source: ByteString, startIndex: Int = 0, endIndex: Int = source.size): ByteString(source)

Decodes symbols from the specified source byte string or its subrange. Returns a ByteString containing the resulting bytes.

The symbols for decoding are not required to be padded. However, if there is a padding character present, the correct amount of padding character(s) must be present. The padding character '=' is interpreted as the end of the encoded byte data. Subsequent symbols are prohibited.

Return

a ByteString with the resulting bytes.

Parameters

source

the byte string to decode symbols from.

startIndex

the beginning (inclusive) of the subrange to decode, 0 by default.

endIndex

the end (exclusive) of the subrange to decode, size of the source byte string by default.

Throws

when startIndex or endIndex is out of range of source byte string indices.

when the symbols for decoding are padded incorrectly or there are extra symbols after the padding.