Skip to content

Instantly share code, notes, and snippets.

@kuwalab
Last active August 29, 2015 14:18
Show Gist options
  • Save kuwalab/1298b3d02b5e803a4106 to your computer and use it in GitHub Desktop.
Save kuwalab/1298b3d02b5e803a4106 to your computer and use it in GitHub Desktop.
Kotlin
package tips.t001
import java.io.BufferedWriter
import java.io.IOException
import java.nio.charset.StandardCharsets
import java.nio.file.Files
import java.nio.file.Paths
fun main(args: Array<String>) {
var outputPath = Paths.get("outputText.txt")
try {
Files.newBufferedWriter(outputPath, StandardCharsets.UTF_8).use<BufferedWriter, Unit> {
it.append("あいうえお")
it.newLine()
}
} catch (e: IOException) {
e.printStackTrace()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment