mirror of
https://github.com/InsanusMokrassar/SDI.git
synced 2024-12-26 18:47:26 +00:00
now it is possible to use custon Json to load Module
This commit is contained in:
parent
2748c3f861
commit
b3966beb32
@ -4,4 +4,7 @@ import kotlinx.serialization.ImplicitReflectionSerializer
|
||||
import kotlinx.serialization.json.Json
|
||||
|
||||
@ImplicitReflectionSerializer
|
||||
fun loadModule(json: String): Module = Json.nonstrict.parse(ModuleDeserializerStrategy, json)
|
||||
fun Json.loadModule(json: String): Module = parse(ModuleDeserializerStrategy, json)
|
||||
|
||||
@ImplicitReflectionSerializer
|
||||
fun loadModule(json: String): Module = Json.nonstrict.loadModule(json)
|
||||
|
@ -2,10 +2,17 @@ package com.insanusmokrassar.sdi
|
||||
|
||||
import kotlinx.io.InputStream
|
||||
import kotlinx.serialization.ImplicitReflectionSerializer
|
||||
import kotlinx.serialization.json.Json
|
||||
import java.io.File
|
||||
|
||||
@ImplicitReflectionSerializer
|
||||
fun loadModule(stream: InputStream) = loadModule(stream.reader().readText())
|
||||
fun Json.loadModule(stream: InputStream) = loadModule(stream.reader().readText())
|
||||
|
||||
@ImplicitReflectionSerializer
|
||||
fun loadModule(file: File) = loadModule(file.inputStream())
|
||||
fun loadModule(stream: InputStream) = Json.nonstrict.loadModule(stream.reader().readText())
|
||||
|
||||
@ImplicitReflectionSerializer
|
||||
fun Json.loadModule(file: File) = loadModule(file.inputStream())
|
||||
|
||||
@ImplicitReflectionSerializer
|
||||
fun loadModule(file: File) = Json.nonstrict.loadModule(file.inputStream())
|
||||
|
Loading…
Reference in New Issue
Block a user