decode

fun decode(sArr: Array<Char>): Array<Byte>

Decodes a BASE64 encoded char array. All illegal characters will be ignored and can handle both arrays with and without line separators.

Return

The decoded array of bytes. May be of length 0. Will be null if the legal characters (including '=') isn't divideable by 4. (I.e. definitely corrupted).

Parameters

sArr

The source array. null or length 0 will return an empty array.


fun decode(sArr: Array<Byte>): Array<Byte>

Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with and without line separators.

Return

The decoded array of bytes. May be of length 0. Will be null if the legal characters (including '=') isn't divideable by 4. (I.e. definitely corrupted).

Parameters

sArr

The source array. Length 0 will return an empty array. null will throw an exception.


fun decode(sArr: Array<Byte>, sOff: Int, sLen: Int): Array<Byte>

Decodes a BASE64 encoded byte array. All illegal characters will be ignored and can handle both arrays with and without line separators.

Return

The decoded array of bytes. May be of length 0. Will be null if the legal characters (including '=') isn't divideable by 4. (I.e. definitely corrupted).

Parameters

sArr

The source array. null will throw an exception.

sOff

The starting position in the source array.

sLen

The number of bytes to decode from the source array. Length 0 will return an empty array.


fun decode(str: String): Array<Byte>

Decodes a BASE64 encoded String. All illegal characters will be ignored and can handle both strings with and without line separators.Note! It can be up to about 2x the speed to call decode(str.toCharArray()) instead. That will create a temporary array though. This version will use str.charAt(i) to iterate the string.

Return

The decoded array of bytes. May be of length 0. Will be null if the legal characters (including '=') isn't divideable by 4. (I.e. definitely corrupted).

Parameters

str

The source string. null or length 0 will return an empty array.