ktoml
ktoml copied to clipboard
Source parser and stream utils
The main motivation for this PR is to replicate what's done in https://github.com/Kotlin/kotlinx.serialization/blob/master/formats/json/jvmMain/src/kotlinx/serialization/json/JvmStreams.kt, because I'm using ktoml currently in an Android app and using streams directly without copying them to memory first would be a huge advantage to me.
The modifications done to the lib are the following:
- change
parseStringsToTomlTreeto use a sequence instead of a list. - add a ktoml-source module, that parses directly from an okio
Source - use this module in
ktoml-file, allowing to avoid copying the file to memory while parsing it - adding JVM-only methods allowing to parse
InputStream
I realize that this introduces JVM-only code, so I could spin the stream-related methods into a new project if needs be.
May be you can also add some small example to the readme? You have added new logic to the API, that can be useful for users.
I fixed diktat/detekt code style issues and fixed some small typos
@akuleshov7 I'll try to look at your comments today, but I may have to delay until next week, I'm a little bit swamped right now
@bishiboosh, you have been waiting for a review for a half of a year (sorry), so I do not think it is a problem for me to wait several week😅
Only today I have noticed that this PR was opened in the same day when this awful war started exactly one year ago. A year has passed already and still it has not ended, oh :(
I have opened #188 to finalise this PR: we need also to think how to reduce the number of affected users of the library.
And finally, after more than a year, I have merged conflicts 🥳 @bishiboosh thank you for this PR and sorry, that it took so long