com.r3corda.core.serialization / OpaqueBytes

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 wont arrive for a few years yet



Constructors

<init> OpaqueBytes(bits: ByteArray)

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 wont arrive for a few years yet

Properties

bits val bits: ByteArray
size val size: Int

Functions

equals open fun equals(other: Any?): Boolean
hashCode open fun hashCode(): Int
open fun open(): ByteArrayInputStream

Returns a ByteArrayInputStream of the bytes

toString open fun toString(): String

Companion Object Functions

of fun of(vararg b: Byte): OpaqueBytes

Extension Functions

deserialize fun <T : Any> OpaqueBytes.deserialize(kryo: <ERROR CLASS> = THREAD_LOCAL_KRYO.get()): T
sha256 fun OpaqueBytes.sha256(): SHA256

Inheritors

DigitalSignature open class DigitalSignature : OpaqueBytes

A wrapper around a digital signature. The covering field is a generic tag usable by whatever is interpreting the signature. It isnt used currently, but experience from Bitcoin suggests such a feature is useful, especially when building partially signed transactions.

SecureHash sealed class SecureHash : OpaqueBytes

Container for a cryptographically secure hash value. Provides utilities for generating a cryptographic hash using different algorithms (currently only SHA-256 supported).

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.