mirror of
https://github.com/InsanusMokrassar/SDI.git
synced 2024-11-27 12:38:55 +00:00
add loadModule
This commit is contained in:
parent
e6b4912835
commit
a5bcddae6e
@ -3,6 +3,7 @@
|
|||||||
## 0.1.2
|
## 0.1.2
|
||||||
|
|
||||||
* All reflection support methods are internal
|
* All reflection support methods are internal
|
||||||
|
* Added `lodModule` functions for more useful working with modules loading
|
||||||
|
|
||||||
## 0.1.1
|
## 0.1.1
|
||||||
|
|
||||||
|
@ -0,0 +1,7 @@
|
|||||||
|
package com.insanusmokrassar.sdi
|
||||||
|
|
||||||
|
import kotlinx.serialization.ImplicitReflectionSerializer
|
||||||
|
import kotlinx.serialization.json.Json
|
||||||
|
|
||||||
|
@ImplicitReflectionSerializer
|
||||||
|
fun loadModule(json: String): Module = Json.nonstrict.parse(Module.serializer(), json)
|
@ -0,0 +1,11 @@
|
|||||||
|
package com.insanusmokrassar.sdi
|
||||||
|
|
||||||
|
import kotlinx.io.InputStream
|
||||||
|
import kotlinx.serialization.ImplicitReflectionSerializer
|
||||||
|
import java.io.File
|
||||||
|
|
||||||
|
@ImplicitReflectionSerializer
|
||||||
|
fun loadModule(stream: InputStream) = loadModule(stream.reader().readText())
|
||||||
|
|
||||||
|
@ImplicitReflectionSerializer
|
||||||
|
fun loadModule(file: File) = loadModule(file.inputStream())
|
Loading…
Reference in New Issue
Block a user