corda / net.corda.core.serialization

Package net.corda.core.serialization

Types

AllWhitelist object AllWhitelist : ClassWhitelist
BuiltInExceptionsWhitelist class BuiltInExceptionsWhitelist : ClassWhitelist
ClassWhitelist interface ClassWhitelist
CompositeKeyLeafSerializer object CompositeKeyLeafSerializer : Serializer<Leaf>

For serialising composite keys

CompositeKeyNodeSerializer object CompositeKeyNodeSerializer : Serializer<Node>
CordaClassResolver class CordaClassResolver : DefaultClassResolver
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.

DefaultKryoCustomizer object DefaultKryoCustomizer
DeserializeAsKotlinObjectDef interface DeserializeAsKotlinObjectDef

Marker interface for kotlin object definitions so that they are deserialized as the singleton instance.

Ed25519PrivateKeySerializer object Ed25519PrivateKeySerializer : Serializer<EdDSAPrivateKey>

For serialising an ed25519 private key

Ed25519PublicKeySerializer object Ed25519PublicKeySerializer : Serializer<EdDSAPublicKey>

For serialising an ed25519 public key

EmptyWhitelist object EmptyWhitelist : ClassWhitelist
GlobalTransientClassWhiteList class GlobalTransientClassWhiteList : MutableClassWhitelist, ClassWhitelist
ImmutableClassSerializer class ImmutableClassSerializer<T : Any> : Serializer<T>

Serializes properties and deserializes by using the constructor. This assumes that all backed properties are set via the constructor and the class is immutable.

InputStreamSerializer object InputStreamSerializer : Serializer<InputStream>
KotlinObjectSerializer object KotlinObjectSerializer : Serializer<DeserializeAsKotlinObjectDef>

Serializer to deserialize kotlin object definitions marked with DeserializeAsKotlinObjectDef.

KryoSerializationCustomization class KryoSerializationCustomization : SerializationCustomization
LoggingWhitelist class LoggingWhitelist : MutableClassWhitelist

This class is not currently used, but can be installed to log a large number of missing entries from the whitelist and was used to track down the initial set.

MutableClassWhitelist interface MutableClassWhitelist : ClassWhitelist
NoReferencesSerializer class NoReferencesSerializer<T> : Serializer<T>
OpaqueBytes open class OpaqueBytes

A simple class that wraps a byte array and makes the equals/hashCode/toString methods work as you actually expect. In an ideal JVM this would be a value type and be completely overhead free. Project Valhalla is adding such functionality to Java, but it won't arrive for a few years yet!

OrderedSerializer object OrderedSerializer : Serializer<HashMap<Any, Any>>
ReferencesAwareJavaSerializer object ReferencesAwareJavaSerializer : JavaSerializer

Improvement to the builtin JavaSerializer by honouring the Kryo.getReferences setting.

SerializationCustomization interface SerializationCustomization
SerializationToken interface SerializationToken

This represents a token in the serialized stream for an instance of a type that implements SerializeAsToken.

SerializeAsToken interface SerializeAsToken

This interface should be implemented by classes that want to substitute a token representation of themselves if they are serialized because they have a lot of internal state that does not serialize (well).

SerializeAsTokenContext class SerializeAsTokenContext

A context for mapping SerializationTokens to/from SerializeAsTokens.

SerializeAsTokenSerializer class SerializeAsTokenSerializer<T : SerializeAsToken> : Serializer<T>

A Kryo serializer for SerializeAsToken implementations.

SerializedBytes class SerializedBytes<T : Any> : OpaqueBytes

A type safe wrapper around a byte array that contains a serialised object. You can call SerializedBytes.deserialize to get the original object back.

SerializedBytesSerializer object SerializedBytesSerializer : Serializer<SerializedBytes<Any>>

A serialiser that avoids writing the wrapper class to the byte stream, thus ensuring SerializedBytes is a pure type safety hack.

SingletonSerializationToken data class SingletonSerializationToken : SerializationToken

A class representing a SerializationToken for some object that is not serializable but can be looked up (when deserialized) via just the class name.

SingletonSerializeAsToken abstract class SingletonSerializeAsToken : SerializeAsToken

A base class for implementing large objects / components / services that need to serialize themselves to a string token to indicate which instance the token is a serialized form of.

WireTransactionSerializer object WireTransactionSerializer : Serializer<WireTransaction>

A serialisation engine that knows how to deserialise code inside a sandbox

Annotations

CordaSerializable annotation class CordaSerializable

This annotation is a marker to indicate that a class is permitted and intended to be serialized as part of Node messaging.

Exceptions

MissingAttachmentsException class MissingAttachmentsException : Exception

Thrown during deserialisation to indicate that an attachment needed to construct the WireTransaction is not found

Extensions for External Classes

com.esotericsoftware.kryo.Kryo
com.esotericsoftware.kryo.io.Input
com.esotericsoftware.kryo.io.Output
kotlin.ByteArray
kotlin.String

Properties

ATTACHMENT_STORAGE val ATTACHMENT_STORAGE: String

Functions

createInternalKryo fun createInternalKryo(k: Kryo = CordaKryo(makeNoWhitelistClassResolver())): Kryo
createKryo fun createKryo(k: Kryo = CordaKryo(makeStandardClassResolver())): Kryo
deserialize fun <T : Any> OpaqueBytes.deserialize(kryo: Kryo = threadLocalP2PKryo()): T
fun SerializedBytes<WireTransaction>.deserialize(kryo: Kryo = threadLocalP2PKryo()): WireTransaction
fun <T : Any> SerializedBytes<T>.deserialize(kryo: Kryo = if (internalOnly) threadLocalStorageKryo() else threadLocalP2PKryo()): T
extendKryoHash fun extendKryoHash(kryo: Kryo): Kryo
makeNoWhitelistClassResolver fun makeNoWhitelistClassResolver(): ClassResolver
makeStandardClassResolver fun makeStandardClassResolver(): ClassResolver
serialize fun <T : Any> T.serialize(kryo: Kryo = threadLocalP2PKryo(), internalOnly: Boolean = false): SerializedBytes<T>

Can be called on any object to convert it to a byte array (wrapped by SerializedBytes), regardless of whether the type is marked as serializable or was designed for it (so be careful!).

threadLocalP2PKryo fun threadLocalP2PKryo(): Kryo
threadLocalStorageKryo fun threadLocalStorageKryo(): Kryo