decodeIntoByteArray
Decodes symbols from the specified source array or its subrange and writes resulting bytes into the destination array. Returns the number of bytes written.
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.
Parameters
source
- the array to decode symbols from.
destination
- the array to write bytes into.
destinationOffset
- the starting index in the
destination
array to write bytes to, 0 by default.
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
array by default.
Exceptions
IndexOutOfBoundsException
- when
startIndex
or
endIndex
is out of range of
source
array indices.
IllegalArgumentException
- when
startIndex > endIndex
.
IndexOutOfBoundsException
- when the resulting bytes don't fit into the
destination
array starting at the specified
destinationOffset
,
or when that index is out of the
destination
array indices range.
IllegalArgumentException
- when the symbols for decoding are padded incorrectly or there are extra symbols after the padding.
Return the number of bytes written into destination array.
fun
decodeIntoByteArray
(
source
:
CharSequence
,
destination
:
ByteArray
,
destinationOffset
:
Int
=
0
,
startIndex
:
Int
=
0
,
endIndex
:
Int
=
source.length
)
:
Int
(source)
Decodes symbols from the specified source char sequence or its substring and writes resulting bytes into the destination array. Returns the number of bytes written.
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.
Parameters
source
- the char sequence to decode symbols from.
destination
- the array to write bytes into.
destinationOffset
- the starting index in the
destination
array to write bytes to, 0 by default.
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.
Exceptions
IndexOutOfBoundsException
- when
startIndex
or
endIndex
is out of range of
source
indices.
IllegalArgumentException
- when
startIndex > endIndex
.
IndexOutOfBoundsException
- when the resulting bytes don't fit into the
destination
array starting at the specified
destinationOffset
,
or when that index is out of the
destination
array indices range.
IllegalArgumentException
- when the symbols for decoding are padded incorrectly or there are extra symbols after the padding.
Return the number of bytes written into destination array.