public interface BytesMarshallable extends ReadBytesMarshallable, WriteBytesMarshallable
Classes implementing this interface should override the methods to provide their own custom serialization and deserialization logic. If not overridden, the default methods use the BytesUtil's methods for reading and writing Marshallable objects.
The $toString method provides a default implementation for creating a string representation of the object in a hexadecimal format.
Implementations of this interface must not be chained as suggested by the DontChain
annotation.
Modifier and Type | Method and Description |
---|---|
default String |
$toString()
Provides a string representation of this object in a hexadecimal format.
|
default void |
readMarshallable(BytesIn<?> bytes)
Reads the state of this object from the bytes.
|
default boolean |
usesSelfDescribingMessage()
Indicates whether the object uses self-describing messages for serialization.
|
default void |
writeMarshallable(BytesOut<?> bytes)
Writes the state of this object to the bytes.
|
default boolean usesSelfDescribingMessage()
usesSelfDescribingMessage
in interface CommonMarshallable
default void readMarshallable(BytesIn<?> bytes) throws net.openhft.chronicle.core.io.IORuntimeException, BufferUnderflowException, IllegalStateException, net.openhft.chronicle.core.io.InvalidMarshallableException
readMarshallable
in interface ReadBytesMarshallable
bytes
- the BytesIn object to read from.net.openhft.chronicle.core.io.IORuntimeException
- If an I/O error occurs.BufferUnderflowException
- If there is not enough data available in the buffer.net.openhft.chronicle.core.io.InvalidMarshallableException
- If the object cannot be read due to invalid data.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayIllegalStateException
default void writeMarshallable(BytesOut<?> bytes) throws IllegalStateException, BufferOverflowException, BufferUnderflowException, ArithmeticException, net.openhft.chronicle.core.io.InvalidMarshallableException
writeMarshallable
in interface WriteBytesMarshallable
bytes
- the BytesOut object to write to.BufferOverflowException
- If there is not enough space in the buffer.BufferUnderflowException
- If there is not enough data available in the buffer.ArithmeticException
- If there is an arithmetic error.net.openhft.chronicle.core.io.InvalidMarshallableException
- If the object cannot be written due to invalid data.net.openhft.chronicle.core.io.ClosedIllegalStateException
- If the resource has been released or closed.net.openhft.chronicle.core.io.ThreadingIllegalStateException
- If this resource was accessed by multiple threads in an unsafe wayIllegalStateException
default String $toString()
Copyright © 2024. All rights reserved.