Updated on 2026-08-14

This commit is contained in:
Tangem 2021-09-06 16:58:56 +03:00
parent dc1eb9d2ba
commit a61f1c0666
12 changed files with 89 additions and 39 deletions

View file

@ -0,0 +1,16 @@
package com.tangem.tap.common.extensions
import android.content.Context
fun Context.readFile(fileName: String): String =
this.openFileInput(fileName).bufferedReader().readText()
fun Context.rewriteFile(content: String, fileName: String) {
this.openFileOutput(fileName, Context.MODE_PRIVATE).use {
it.write(content.toByteArray(), 0, content.length)
}
}
fun Context.readAssetAsString(fileName: String): String {
return this.assets.open("$fileName.json").bufferedReader().readText()
}