decodingWith

JVM
1.8
@ExperimentalEncodingApi fun InputStream.decodingWith(
    base64: Base64
): InputStream

(source)

Returns an input stream that decodes symbols from this input stream using the specified base64 encoding.

Reading from the returned input stream leads to reading some symbols from the underlying input stream. The symbols are decoded using the specified base64 encoding and the resulting bytes are returned. Symbols are decoded in 4-symbol blocks.

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 symbol stream. Subsequent symbols are not read even if the end of the underlying input stream is not reached.

The returned input stream should be closed in a timely manner. We suggest you try the use function, which closes the resource after a given block of code is executed. The close operation discards leftover bytes. Closing the returned input stream will close the underlying input stream.