refs #35 refac to get caching out of Obj; it is decoder/encoder matter now
This commit is contained in:
1 parent
405ff2ec2b
commit
20181c63a1
4 files changed
+70
-68
No files matched your search
@@ -39,9 +39,8 @@ open class LynonDecoder(val bin: BitInput, val settings: LynonSettings = LynonSe
|
||||
type.objClass.deserialize(scope, this, type)
|
||||
}
|
||||
|
||||
// todo: rewrite/remove?
|
||||
suspend fun unpackObject(scope: Scope, type: ObjClass): Obj {
|
||||
return type.deserialize(scope, this, null)
|
||||
suspend fun decodeObject(scope: Scope, type: ObjClass): Obj {
|
||||
return decodeCached { type.deserialize(scope, this, null) }
|
||||
}
|
||||
|
||||
fun unpackBinaryData(): ByteArray = bin.decompress()
|
||||
|
||||
@@ -65,8 +65,10 @@ open class LynonEncoder(val bout: BitOutput, val settings: LynonSettings = Lynon
|
||||
bout.putBits(type.ordinal.toULong(), 4)
|
||||
}
|
||||
|
||||
suspend fun encodeObj(scope: Scope, obj: Obj) {
|
||||
suspend fun encodeObject(scope: Scope, obj: Obj) {
|
||||
encodeCached(obj) {
|
||||
obj.serialize(scope, this, null)
|
||||
}
|
||||
}
|
||||
|
||||
fun encodeBinaryData(data: ByteArray) {
|
||||
|
||||
Reference in new issue
Block a user