Filesystem { public Flowable<String> readTextFile(String pathToFile) { return Flowable.generate( () -> new BufferedReader(new InputStreamReader(new FileInputStream(pathToFile))), (reader, emitter) -> { if (reader.ready()) { emitter.onNext(reader.readLine()); } else { emitter.onComplete(); } }, BufferedReader::close); }  Flowable<String> readTextFile(String pathToFile); Flowable<String> readTextFileFromClasspath(String resourcePath); Single<String> readTextFileFully(String pathToFile); Single<String> readTextFileFullyFromClasspath(String resourcePath); Completable writeFile(final String content, String filePath); Completable writeFileSync(String content, String filePath, boolean append); Completable writeFileSync(String content, Charset encoding, String filePath, boolean append);  }
@Test void testReadTextFile() { TestSubscriber<String> testSubscriber = filesystem.readTextFile("src/test/resources/someFile.txt").test(); testSubscriber.assertValueCount(3); testSubscriber.assertValues("This is some content in some file.","", "This is more content."); }