MessagePackCodec

zio.blocks.schema.msgpack.MessagePackCodec
See theMessagePackCodec companion object
abstract class MessagePackCodec[A] extends BinaryCodec[A]

Abstract class for encoding and decoding values of type A to and from MessagePack format. Encapsulates logic to map MessagePack binary representations into native type structures and vice versa.

This class requires an implementation for two core operations: decoding a value of type A from a MessagePack representation and encoding a value of type A into a MessagePack representation.

Attributes

Companion
object
Source
MessagePackCodec.scala
Graph
Supertypes
class BinaryCodec[A]
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

Attempts to decode a value of type A from the specified MessagePackReader, but may fail with MessagePackCodecError error if the MessagePack input does not encode a value of this type.

Attempts to decode a value of type A from the specified MessagePackReader, but may fail with MessagePackCodecError error if the MessagePack input does not encode a value of this type.

Value parameters

in

an instance of MessagePackReader which provides access to the MessagePack input to parse a MessagePack value to value of type A

Attributes

Source
MessagePackCodec.scala
def encodeValue(x: A, out: MessagePackWriter): Unit

Encodes the specified value using provided MessagePackWriter, but may fail with MessagePackCodecError if it cannot be encoded properly according to MessagePack specification requirements.

Encodes the specified value using provided MessagePackWriter, but may fail with MessagePackCodecError if it cannot be encoded properly according to MessagePack specification requirements.

Value parameters

out

an instance of MessagePackWriter which provides access to MessagePack output to serialize the specified value as a MessagePack value

x

the value provided for serialization

Attributes

Source
MessagePackCodec.scala

Concrete methods

override def decode(input: ByteBuffer): Either[SchemaError, A]

Decodes a value of type A from the given ByteBuffer. If decoding fails, a SchemaError is returned.

Decodes a value of type A from the given ByteBuffer. If decoding fails, a SchemaError is returned.

Value parameters

input

the ByteBuffer containing the binary data to be decoded

Attributes

Returns

Either where the Left contains a SchemaError if decoding fails, or the Right contains the successfully decoded value of type A

Definition Classes
Source
MessagePackCodec.scala
def decode(input: Array[Byte]): Either[SchemaError, A]

Decodes a value of type A from the given byte array. If decoding fails, a SchemaError is returned.

Decodes a value of type A from the given byte array. If decoding fails, a SchemaError is returned.

Value parameters

input

the byte array containing the binary data to be decoded

Attributes

Returns

Either where the Left contains a SchemaError if decoding fails, or the Right contains the successfully decoded value of type A

Source
MessagePackCodec.scala
override def encode(value: A, output: ByteBuffer): Unit

Encodes the specified value of type A into binary format and writes it to the provided ByteBuffer.

Encodes the specified value of type A into binary format and writes it to the provided ByteBuffer.

Value parameters

output

the ByteBuffer where the encoded binary data is written

value

the value of type A to be serialized into binary format

Attributes

Definition Classes
Source
MessagePackCodec.scala
def encode(value: A): Array[Byte]

Encodes the specified value of type A into a binary format.

Encodes the specified value of type A into a binary format.

Value parameters

value

the value of type A to be serialized into binary format

Attributes

Returns

an array of bytes representing the binary-encoded data

Source
MessagePackCodec.scala
def error(msg: String): Nothing

Attributes

Source
MessagePackCodec.scala
def error(span: Node, error: Throwable): Nothing

Attributes

Source
MessagePackCodec.scala