corda / net.corda.core.serialization / CordaKryo

CordaKryo

open class CordaKryo : Kryo

We need to disable whitelist checking during calls from our Kryo code to register a serializer, since it checks for existing registrations and then will enter our CordaClassResolver.getRegistration method.

Constructors

<init> CordaKryo(classResolver: ClassResolver)

We need to disable whitelist checking during calls from our Kryo code to register a serializer, since it checks for existing registrations and then will enter our CordaClassResolver.getRegistration method.

Functions

register open fun register(type: Class<*>?): Registration
open fun register(type: Class<*>?, id: Int): Registration
open fun register(type: Class<*>?, serializer: Serializer<*>?): Registration
open fun register(registration: Registration?): Registration

Extension Properties

attachmentStorage var Kryo.attachmentStorage: AttachmentStorage?

Extension Functions

addToWhitelist fun Kryo.addToWhitelist(type: Class<*>): Unit
noReferencesWithin fun <T : Any> Kryo.noReferencesWithin(): Unit

Use this method to mark any types which can have the same instance within it more than once. This will make sure the serialised form is stable across multiple serialise-deserialise cycles. Using this on a type with internal cyclic references will throw a stack overflow exception during serialisation.

register fun <T : Any> Kryo.register(type: KClass<T>, read: (Kryo, Input) -> T, write: (Kryo, Output, T) -> Unit): Registration
useClassLoader fun <T> Kryo.useClassLoader(cl: ClassLoader, body: () -> T): T