ABSENT
Do not pad on encode, prohibit padding on decode.
When encoding, the result is not padded. When decoding, the input must not contain any padding character.
Samples
import kotlin.io.encoding.*
import kotlin.test.*
fun main() {
//sampleStart
val format = HexFormat { upperCase = true; bytes.byteSeparator = " " }
val bytes = byteArrayOf(0xDE.toByte(), 0x2D, 0x02, 0xC0.toByte())
val base64AbsentPadding = Base64.Default.withPadding(Base64.PaddingOption.ABSENT)
// PaddingOption.ABSENT does not pad on encode, and requires unpadded input on decode
println(base64AbsentPadding.encode(bytes)) // 3i0CwA
println(base64AbsentPadding.decode("3i0CwA").toHexString(format)) // DE 2D 02 C0
// PaddingOption.ABSENT requires the decode input not to be padded
// base64AbsentPadding.decode("3i0CwA==") // will fail with IllegalArgumentException
//sampleEnd
}