KStarbound/src/main/kotlin/ru/dbotthepony/kstarbound/json/VersionedJson.kt
2024-02-03 20:41:51 +07:00

13 lines
412 B
Kotlin

package ru.dbotthepony.kstarbound.json
import com.google.gson.JsonElement
import ru.dbotthepony.kommons.io.readBinaryString
import java.io.DataInputStream
data class VersionedJson(val identifier: String, val version: Int?, val content: JsonElement) {
constructor(data: DataInputStream) : this(
data.readBinaryString(),
data.read().let { if (it > 0) data.readInt() else null },
data.readJsonElement())
}