working ByteArray64Reader (UTF-8 compliant with proper surrogate pairing)

This commit is contained in:
minjaesong
2021-08-31 11:27:40 +09:00
parent 909c381572
commit 32144fc241
8 changed files with 147 additions and 41 deletions

View File

@@ -19,9 +19,12 @@ object WriteActor {
}
fun encodeToByteArray64(actor: Actor): ByteArray64 {
val ba = ByteArray64()
this.invoke(actor).toByteArray().forEach { ba.add(it) }
return ba
val baw = ByteArray64Writer(Common.CHARSET)
Common.jsoner.toJson(actor, actor.javaClass, baw)
baw.flush(); baw.close()
return baw.toByteArray64()
}
}