earroyoron
02/23/2020, 9:21 PMearroyoron
02/23/2020, 9:22 PMval stream: Flow<String> = File(arguments.filename).readLines().asFlow()
I am consuming the flow with something as:
runBlocking {
stream
.map { <whatever> }
.filter { <whatever> }
.collect { println(it) }
...
}
🔴 I know that readLines
gets all content and closes the stream. but and I though it could be easy to “iterate” to the next version that do not close the stream over the file.
BUT I CANNOT FIND HOW TO KEEP THE FLOW “LIVE” ??
Some idea?
PD: I tried to use a Timer to run periodically the “collector” but in this case the file is always read “from the beggining”… 😞satyan
02/24/2020, 7:22 AMearroyoron
02/24/2020, 8:46 PM