encodingWith

JVM
1.8
@ExperimentalEncodingApi fun OutputStream.encodingWith(
    base64: Base64
): OutputStream

(source)

Returns an output stream that encodes bytes using the specified base64 encoding and writes the result to this output stream.

The byte data written to the returned output stream is encoded using the specified base64 encoding and the resulting symbols are written to the underlying output stream. Bytes are encoded in 3-byte blocks.

The returned output 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 writes properly padded leftover symbols to the underlying output stream. Closing the returned output stream will close the underlying output stream.