Is there a memory-light way of doing URL -> Flow?
salamanders opened this issue · 0 comments
salamanders commented
Without loading the whole text into memory, is there an easy way of
- URL: https://mysite.com/mybigflatdoc.json of many, many MyElement in an array
- Open an input stream
- Without loading the whole thing, return a Flow
I found a way to do it the hacky way in GSON, but I was hoping to move to this library to do it without loading the whole thing!
fun readScript(scriptURL: String): Flow<Point2D> =
(GSON.fromJson(URL(scriptURL).readTextSupportGZIP(), listOfPointsType) as List<Point2D>)
.asFlow()