Skip to content

Instantly share code, notes, and snippets.

@fuCtor
Created June 8, 2018 07:27
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save fuCtor/10580c28455b813019c73831de266873 to your computer and use it in GitHub Desktop.
import java.io._
import monix.reactive.Observable
object FileReader {
def fileObservable(files: Seq[String]): Observable[String] = {
Observable.fromIterable(files).flatMap({ file =>
Observable.fromLinesReader(new BufferedReader(new InputStreamReader(new FileInputStream(file))))
.doOnSubscribe(() => println(s"START [$file]"))
.doOnComplete(() => println(s"FINISH [$file]"))
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment