Base64

object Base64

Functions

Link copied to clipboard
fun decode(str: String, url: Boolean = false): ByteArray

Base64 decodes str to a ByteArray. Set url to true if str is Base64Url encoded.

fun decode(ignoreSpaces: Boolean, str: String, url: Boolean = false): ByteArray

fun decode(src: ByteArray, dst: ByteArray, url: Boolean = false): Int

Base64 decodes src to dst. Set url to true if src is Base64Url encoded.

Link copied to clipboard
fun decodeIgnoringSpaces(str: String, url: Boolean = false): ByteArray

Base64 decodes str to a ByteArray after removing spaces, newlines, carriage returns, and tabs. Set url to true if str is Base64Url encoded.

Link copied to clipboard
fun encode(src: ByteArray, url: Boolean = false, doPadding: Boolean = false): String

Base64 encodes src to a String. Set url to true if the Base64Url encoding character set should be used. If url is true, doPadding can optionally be set to true to include padding characters in the output. doPadding is ignored if url is false.

Link copied to clipboard
operator fun invoke(v: ByteArray, url: Boolean = false): String

Base64 encodes v to a String. Set url to true to use Base64Url encoding.

operator fun invoke(v: String, url: Boolean = false): ByteArray

Base64 decodes v to a ByteArray. Set url to true if v is Base64Url encoded.