ssz / org.apache.tuweni.ssz / SSZWriter

SSZWriter

interface SSZWriter (source)

A writer for encoding values to SSZ.

Functions

writeAddress

open fun writeAddress(address: Bytes): Unit

Write an address.

writeAddressList

open fun writeAddressList(vararg elements: Bytes): Unit
open fun writeAddressList(elements: MutableList<out Bytes>): Unit

Write a list of addresses.

writeBigInteger

open fun writeBigInteger(value: BigInteger, bitLength: Int): Unit

Write a big integer to the output.

writeBigIntegerList

open fun writeBigIntegerList(bitLength: Int, vararg elements: BigInteger): Unit
open fun writeBigIntegerList(bitLength: Int, elements: MutableList<BigInteger>): Unit

Write a list of big integers.

writeBoolean

open fun writeBoolean(value: Boolean): Unit

Write a boolean to the output.

writeBooleanList

open fun writeBooleanList(vararg elements: Boolean): Unit
open fun writeBooleanList(elements: MutableList<Boolean>): Unit

Write a list of booleans.

writeBytes

open fun writeBytes(value: Bytes): Unit

Encode a Bytes value to SSZ.

open fun writeBytes(value: ByteArray): Unit

Encode a byte array to SSZ.

writeBytesList

open fun writeBytesList(vararg elements: Bytes): Unit
open fun writeBytesList(elements: MutableList<out Bytes>): Unit

Write a list of bytes.

writeFixedBytes

open fun writeFixedBytes(value: Bytes): Unit

Encode a known fixed-length Bytes value to SSZ without the length mixin.

writeFixedBytesList

open fun writeFixedBytesList(elements: MutableList<out Bytes>): Unit

Write a list of known-size homogenous bytes. The list itself WILL have a length mixin, but the elements WILL NOT.

writeFixedBytesVector

open fun writeFixedBytesVector(elements: MutableList<out Bytes>): Unit

Write a known-size fixed-length list of known-size homogenous bytes. Neither the list nor the elements in the list will have a length mixin.

writeHash

open fun writeHash(hash: Bytes): Unit

Write a hash.

writeHashList

open fun writeHashList(vararg elements: Bytes): Unit
open fun writeHashList(elements: MutableList<out Bytes>): Unit

Write a list of hashes.

writeInt

open fun writeInt(value: Int, bitLength: Int): Unit

Write a two's-compliment integer to the output.

writeInt16

open fun writeInt16(value: Int): Unit

Write a 16-bit two's-compliment integer to the output.

writeInt16List

open fun writeInt16List(vararg elements: Int): Unit
open fun writeInt16List(elements: MutableList<Int>): Unit

Write a list of 16-bit two's compliment integers.

writeInt32

open fun writeInt32(value: Int): Unit

Write a 32-bit two's-compliment integer to the output.

writeInt32List

open fun writeInt32List(vararg elements: Int): Unit
open fun writeInt32List(elements: MutableList<Int>): Unit

Write a list of 32-bit two's compliment integers.

writeInt64

open fun writeInt64(value: Long): Unit

Write a 64-bit two's-compliment integer to the output.

writeInt64List

open fun writeInt64List(vararg elements: Long): Unit
open fun writeInt64List(elements: MutableList<Long>): Unit

Write a list of 64-bit two's compliment integers.

writeInt8

open fun writeInt8(value: Int): Unit

Write an 8-bit two's-compliment integer to the output.

writeInt8List

open fun writeInt8List(vararg elements: Int): Unit
open fun writeInt8List(elements: MutableList<Int>): Unit

Write a list of 8-bit two's compliment integers.

writeIntList

open fun writeIntList(bitLength: Int, vararg elements: Int): Unit
open fun writeIntList(bitLength: Int, elements: MutableList<Int>): Unit

Write a list of two's compliment integers.

writeLong

open fun writeLong(value: Long, bitLength: Int): Unit

Write a two's-compliment long to the output.

writeLongIntList

open fun writeLongIntList(bitLength: Int, vararg elements: Long): Unit
open fun writeLongIntList(bitLength: Int, elements: MutableList<Long>): Unit

Write a list of two's compliment long integers.

writeSSZ

abstract fun writeSSZ(value: Bytes): Unit
open fun writeSSZ(value: ByteArray): Unit

Append an already SSZ encoded value. Note that this method may not validate that value is a valid SSZ sequence. Appending an invalid SSZ sequence will cause the entire SSZ encoding produced by this writer to also be invalid.

writeString

open fun writeString(str: String): Unit

Write a string to the output.

writeStringList

open fun writeStringList(vararg elements: String): Unit
open fun writeStringList(elements: MutableList<String>): Unit

Write a list of strings, which must be of the same length

writeUBigInteger

open fun writeUBigInteger(value: BigInteger, bitLength: Int): Unit

Write an unsigned big integer to the output.

writeUInt

open fun writeUInt(value: Int, bitLength: Int): Unit

Write an unsigned integer to the output. Note that the argument value is a native signed int but will be interpreted as an unsigned value.

writeUInt16

open fun writeUInt16(value: Int): Unit

Write a 16-bit unsigned integer to the output.

writeUInt16List

open fun writeUInt16List(vararg elements: Int): Unit
open fun writeUInt16List(elements: MutableList<Int>): Unit

Write a list of 16-bit unsigned integers.

writeUInt256

open fun writeUInt256(value: UInt256): Unit

Write a UInt256 to the output.

writeUInt256List

open fun writeUInt256List(vararg elements: UInt256): Unit
open fun writeUInt256List(elements: MutableList<UInt256>): Unit

Write a list of unsigned 256-bit integers.

writeUInt32

open fun writeUInt32(value: Long): Unit

Write a 32-bit unsigned integer to the output.

writeUInt32List

open fun writeUInt32List(vararg elements: Long): Unit
open fun writeUInt32List(elements: MutableList<Long>): Unit

Write a list of 32-bit unsigned integers.

writeUInt384

open fun writeUInt384(value: UInt384): Unit

Write a UInt384 to the output.

writeUInt384List

open fun writeUInt384List(elements: MutableList<UInt384>): Unit
open fun writeUInt384List(vararg elements: UInt384): Unit

Write a list of unsigned 384-bit integers.

writeUInt64

open fun writeUInt64(value: Long): Unit

Write a 64-bit unsigned integer to the output. Note that the argument value is a native signed long but will be interpreted as an unsigned value.

writeUInt64List

open fun writeUInt64List(vararg elements: Long): Unit
open fun writeUInt64List(elements: MutableList<Long>): Unit

Write a list of 64-bit unsigned integers. Note that the elements are native signed longs, but will be interpreted as an unsigned values.

writeUInt8

open fun writeUInt8(value: Int): Unit

Write an 8-bit unsigned integer to the output.

writeUInt8List

open fun writeUInt8List(vararg elements: Int): Unit
open fun writeUInt8List(elements: MutableList<Int>): Unit

Write a list of 8-bit unsigned integers.

writeUIntList

open fun writeUIntList(bitLength: Int, vararg elements: Int): Unit
open fun writeUIntList(bitLength: Int, elements: MutableList<Int>): Unit

Write a list of unsigned integers. Note that the elements are native signed ints, but will be interpreted as an unsigned values.

writeULong

open fun writeULong(value: Long, bitLength: Int): Unit

Write an unsigned long to the output. Note that the argument value is a native signed long but will be interpreted as an unsigned value.

writeULongIntList

open fun writeULongIntList(bitLength: Int, vararg elements: Long): Unit
open fun writeULongIntList(bitLength: Int, elements: MutableList<Long>): Unit

Write a list of unsigned long integers. Note that the elements are native signed longs, but will be interpreted as an unsigned values.

writeVector

open fun writeVector(elements: MutableList<out Bytes>): Unit

Write a vector of bytes.