public class KuraBinaryPayloadCodec extends Object implements BinaryPayloadCodec
| Modifier and Type | Class and Description |
|---|---|
static class |
KuraBinaryPayloadCodec.Builder |
| Modifier and Type | Method and Description |
|---|---|
Payload |
decode(ByteBuffer buffer)
Decode a
Payload structure from the provided BLOB |
ByteBuffer |
encode(Payload payload,
ByteBuffer buffer)
Encode a
Payload structure into a BLOB |
public ByteBuffer encode(Payload payload, ByteBuffer buffer) throws Exception
BinaryPayloadCodecPayload structure into a BLOB
The payload information gets encoded into a blob and appended at the end of the
provided buffer. If the provided buffer is null a new buffer will be allocated.
Note: The returning buffer may not be the same as the provided buffer. If the provided buffer has less remaining space than required a new buffer is allocated and returned, which will contain both the existing content as well as the newly appended.
encode in interface BinaryPayloadCodecpayload - The payload to encode, must not be nullbuffer - An optional buffer to append the output to, may be nullnullException - if anything goes wrongpublic Payload decode(ByteBuffer buffer) throws Exception
BinaryPayloadCodecPayload structure from the provided BLOBdecode in interface BinaryPayloadCodecbuffer - The buffer to read from, must not be nullnullException - if anything goes wrongCopyright © 2017. All rights reserved.