outputStream

open suspend override fun outputStream(path: Path, append: Boolean): Sink(source)

Creates a Sink for writing to a file. If the file doesn't exist, it will be created. If the parent directories don't exist, they will be created. The returned Sink is buffered. It is created with Dispatchers.IO context.

Return

A buffered Sink object for writing.

Parameters

path

The path where Sink will be created.

append

Append to existing content (true) or overwrite (false). Default is false (overwrite).

Throws

if the path is a directory or any other I/O error occurs during Sink creation.