Created
June 9, 2020 12:25
-
-
Save arkivanov/550f6a4a21e3689b70536182a4bc24b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| internal class KittenDataSourceImpl : KittenDataSource { | |
| override fun load(limit: Int, offset: Int): Maybe<String> = | |
| maybeFromFunction { | |
| val url = URL(makeKittenEndpointUrl(limit = limit, offset = offset)) | |
| val connection = url.openConnection() as HttpURLConnection | |
| connection | |
| .inputStream | |
| .bufferedReader() | |
| .use(BufferedReader::readText) | |
| } | |
| .subscribeOn(ioScheduler) | |
| .onErrorComplete() | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment