fun OutputStream.writer(charset: Charset = Charsets.UTF_8): OutputStreamWriter
fun File.writer(charset: Charset = Charsets.UTF_8): OutputStreamWriter
val writer = OutputStreamWriter(FileOutputStream(file), charset)
writer.write(...)
writer.close()
file.outputStream()
.writer(charset)
.use {
it.write(...)
}
file.writer(charset)
.use {
it.write(...)
}