public interface MethodEncoder
A method encoder is responsible for encoding a method call into a BytesOut
object and decoding the method call from a BytesIn
object.
This encoding/decoding is often necessary for serializing method calls or for sending method calls over a network for remote procedure calls (RPC).
Implementations of this interface should ensure that the encode and decode methods are properly synchronized if they're intended to be used in a multi-threaded context.
Modifier and Type | Method and Description |
---|---|
Object[] |
decode(Object[] lastObjects,
BytesIn<?> in)
Decodes a method call from a
BytesIn object into an array of objects. |
void |
encode(Object[] objects,
BytesOut<?> out)
Encodes a method call, represented by an array of objects, into a
BytesOut object. |
long |
messageId()
Returns a unique identifier for the method being encoded.
|
long messageId()
void encode(Object[] objects, BytesOut<?> out) throws IllegalArgumentException, BufferUnderflowException, IllegalStateException, BufferOverflowException, ArithmeticException, net.openhft.chronicle.core.io.InvalidMarshallableException
BytesOut
object.objects
- the objects representing a method callout
- the BytesOut object to write the method call toIllegalArgumentException
- if an argument is not validBufferUnderflowException
- if there is not enough data available in the bufferIllegalStateException
- if a state-dependent method has been invoked at an inappropriate timeBufferOverflowException
- if there is not enough space in the bufferArithmeticException
- if numeric overflow occursnet.openhft.chronicle.core.io.InvalidMarshallableException
- if an object is not correctly marshallableObject[] decode(Object[] lastObjects, BytesIn<?> in) throws BufferUnderflowException, IllegalStateException, net.openhft.chronicle.core.io.InvalidMarshallableException
BytesIn
object into an array of objects.lastObjects
- the previous objects used for the method call, can be used for delta encodingin
- the BytesIn object to read the method call fromBufferUnderflowException
- if there is not enough data available in the bufferIllegalStateException
- if a state-dependent method has been invoked at an inappropriate timenet.openhft.chronicle.core.io.InvalidMarshallableException
- if an object is not correctly marshallableCopyright © 2023. All rights reserved.