dorkbox.serializers.ZoneIdSerializer.kt Maven / Gradle / Ivy
The newest version!
package dorkbox.serializers
import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.Serializer
import com.esotericsoftware.kryo.io.Input
import com.esotericsoftware.kryo.io.Output
import java.time.ZoneId
class ZoneIdSerializer: Serializer() {
override fun write(kryo: Kryo, output: Output, zoneId: ZoneId) {
output.writeString(zoneId.id)
}
override fun read(kryo: Kryo, input: Input, type: Class): ZoneId {
return ZoneId.of(input.readString())
}
}