Skip to content

Instantly share code, notes, and snippets.

@vamsitallapudi
Created January 16, 2018 07:46
Show Gist options
  • Save vamsitallapudi/81f76aeb0bd195c2d78f616f9a53efe0 to your computer and use it in GitHub Desktop.
Save vamsitallapudi/81f76aeb0bd195c2d78f616f9a53efe0 to your computer and use it in GitHub Desktop.
Read a file in Kotlin using Extension Function
try {
val inputStream:InputStream = assets.open("news_data_file.json")
val inputString = inputStream.bufferedReader().use{it.readText()}
Log.d(TAG,inputString)
} catch (e:Exception){
Log.d(TAG, e.toString())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment