📜  写入文件 kotlin 代码示例

📅  最后修改于: 2022-03-11 14:53:33.341000             🧑  作者: Mango

代码示例1
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()  
}