This tutorial shows you ways to write to File in Kotlin using PrintWriter
, BufferedWriter
or Kotlin extension functions such as writeText()
or write()
. You’ll also know how to write Kotlin objects/JSON to a file.
Related Posts:
– How to read File in Kotlin
– Kotlin – Convert object to/from JSON string using Gson