corda / net.corda.core.serialization / SerializedBytes

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.

Constructors

<init>

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

SerializedBytes(bytes: ByteArray)

Properties

hash

val hash: SecureHash

Companion Object Functions

from

Serializes the given object and returns a SerializedBytes wrapper for it. An alias for Any.serialize intended to make the calling smoother for Java users.

fun <T : Any> from(obj: T, serializationFactory: SerializationFactory = SerializationFactory.defaultFactory, context: SerializationContext = serializationFactory.defaultContext): SerializedBytes<T>

Extension Properties

isZero

val OpaqueBytes.isZero: Boolean

Extension Functions

deserialize

Convenience extension method for deserializing SerializedBytes with type matching, utilising the defaults.

fun <T : Any> SerializedBytes<T>.deserialize(serializationFactory: SerializationFactory = SerializationFactory.defaultFactory, context: SerializationContext = serializationFactory.defaultContext): T

deserializeWithCompatibleContext

Additionally returns SerializationContext which was used for encoding. It might be helpful to know SerializationContext to use the same encoding in the reply.

fun <T : Any> ByteSequence.deserializeWithCompatibleContext(serializationFactory: SerializationFactory = SerializationFactory.defaultFactory, context: SerializationContext = serializationFactory.defaultContext): ObjectWithCompatibleContext<T>

hashAs

Compute the algorithm hash for the contents of the OpaqueBytes.

fun OpaqueBytes.hashAs(algorithm: String): SecureHash

sha256

Compute the SHA-256 hash for the contents of the OpaqueBytes.

fun OpaqueBytes.sha256(): SHA256