FileOutputStream Kotlin Exemple

val file:String = fileName.text.toString()  
val data:String = fileData.text.toString()  
val fileOutputStream:FileOutputStream  
try {  
    fileOutputStream = openFileOutput(file, Context.MODE_PRIVATE)  
    fileOutputStream.write(data.toByteArray())  
}catch (e: Exception){  
    e.printStackTrace()  
}  
Zarden