openReadWrite

Opens a File for read/write operations. The File is not truncated if it already exists, and the initial FileStream.position is 0.

e.g.

"/path/to/my/file".toFile().openReadWrite(excl = OpenExcl.MustExist).use { s ->
    // read
    // write
}

Return

A FileStream.ReadWrite for read/write operations.

Parameters

excl

The OpenExcl desired for this open operation. If null, then OpenExcl.MaybeCreate.DEFAULT will be used.

See also

Throws

If there was a failure to open the File for the provided excl argument, if the File points to an existing directory, or if the filesystem threw a security exception.

UnsupportedOperationException

On Kotlin/JS-Browser.