corda / net.corda.core.serialization / CustomSerializationScheme

CustomSerializationScheme

interface CustomSerializationScheme

Implement this interface to add your own Serialization Scheme. This is an experimental feature. All methods in this class MUST be thread safe i.e. methods from the same instance of this class can be called in different threads simultaneously.

Functions

deserialize

This method must deserialize the data stored bytes into an instance of T.

abstract fun <T : Any> deserialize(bytes: ByteSequence, clazz: Class<T>, context: SerializationSchemeContext): T

getSchemeId

This method must return an id used to uniquely identify the Scheme. This should be unique within a network as serialized data might be sent over the wire.

abstract fun getSchemeId(): Int

serialize

This method must be able to serialize any object T into a ByteSequence.

abstract fun <T : Any> serialize(obj: T, context: SerializationSchemeContext): ByteSequence