public static final class Message.Serializer
extends java.lang.Object
ParamType
), and a byte array value.
The param value is prefixed with it's length, encoded as an unsigned vint, followed by by the value's bytes.
Legacy Notes (see serialize(Message, DataOutputPlus, int)
for complete details):
- pre 4.0, the IP address was sent along in the header, before the verb. The IP address may be either IPv4 (4 bytes) or IPv6 (16 bytes)
- pre-4.0, the verb was encoded as a 4-byte integer; in 4.0 and up it is an unsigned vint
- pre-4.0, the payloadSize was encoded as a 4-byte integer; in 4.0 and up it is an unsigned vint
- pre-4.0, the count of param key-value pairs was encoded as a 4-byte integer; in 4.0 and up it is an unsigned vint
- pre-4.0, param names were encoded as strings; in 4.0 they are encoded as enum id vints
- pre-4.0, expiry time wasn't encoded at all; in 4.0 it's an unsigned vint
- pre-4.0, message id was an int; in 4.0 and up it's an unsigned vint
- pre-4.0, messages included PROTOCOL MAGIC BYTES; post-4.0, we rely on frame CRCs instead
- pre-4.0, messages would serialize boolean params as dummy ONE_BYTEs; post-4.0 we have a dedicated 'flags' vint
1 1 1 1 1 2 2 2 2 2 3
0 2 4 6 8 0 2 4 6 8 0 2 4 6 8 0
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Message ID (vint) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Creation timestamp (int) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Expiry (vint) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Verb (vint) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Flags (vint) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Param count (vint) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| /
/ Params /
/ |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| Payload size (vint) |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
| /
/ Payload /
/ |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
Modifier and Type | Method and Description |
---|---|
<T> Message<T> |
deserialize(DataInputPlus in,
InetAddressAndPort peer,
int version) |
<T> Message<T> |
deserialize(DataInputPlus in,
Message.Header header,
int version)
A partial variant of deserialize, taking in a previously deserialized
Message.Header as an argument. |
<T> void |
serialize(Message<T> message,
DataOutputPlus out,
int version) |
public <T> void serialize(Message<T> message, DataOutputPlus out, int version) throws java.io.IOException
java.io.IOException
public <T> Message<T> deserialize(DataInputPlus in, InetAddressAndPort peer, int version) throws java.io.IOException
java.io.IOException
public <T> Message<T> deserialize(DataInputPlus in, Message.Header header, int version) throws java.io.IOException
Message.Header
as an argument.
Skip deserializing the Message.Header
from the input stream in favour of using the provided header.java.io.IOException
Copyright © 2009- The Apache Software Foundation