I was wondering if I understood this correctly…
For a the code where we bring in the file of ANewHope.txt we do:
fun loadText(filename: String): Single{
return Single.create create@{ emitter →
…
}
this creates a single observerable for the file. the emitter traverses through this SINGLE file.
@macsimus Can you please help with this when you get a chance? Thank you - much appreciated! :]
Hi Jose! Thanks for the question.
Inside the loadText()
method, we use the Kotlin extension function file.readText(UTF_8)
to read the contents of the file. If the file is successfully read, the Single
observable emits just one string, which is the contents of the entire file. If the file is not read, the Single
emits an error event.