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 bufferBufferOverflowException
- If there is not enough space in the bufferArithmeticException
- If numeric overflow occursnet.openhft.chronicle.core.io.InvalidMarshallableException
- If an object is not correctly marshallablenet.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
Object[] 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 buffernet.openhft.chronicle.core.io.InvalidMarshallableException
- If an object is not correctly marshallablenet.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
Copyright © 2024. All rights reserved.