decode Base64Zlib To String
Decode a QR payload: Base64 (URL-safe or standard) → inflate (gzip/zlib/raw-deflate) → UTF-8 string.
The function tries to auto-detect:
Base64 alphabet (URL-safe first, then standard), optionally fixing missing padding.
Compression container: gzip (RFC1952), zlib (RFC1950), or raw DEFLATE (no headers).
Returns null on any problem (invalid Base64, corrupt stream, unsupported format, or if the inflated output exceeds maxOutputBytes).
Example
val text = QrZlibB64.decodeBase64ZlibToString(b64Payload)
if (text != null) {
// use the UTF-8 content (e.g., JSON)
}Return
The decoded UTF-8 string, or null if decoding fails or size cap is exceeded.
Parameters
The Base64 or Base64URL string (padding optional).
Try Base64URL decoder first (common for QR). Falls back to standard if needed.
If true, auto-adds '=' padding when length % 4 != 0.
Hard limit on inflated size to mitigate zip-bombs (default 2 MiB).