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
BinaryPayloadCodec
Payload
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 BinaryPayloadCodec
payload
- The payload to encode, must not be null
buffer
- An optional buffer to append the output to, may be null
null
Exception
- if anything goes wrongpublic Payload decode(ByteBuffer buffer) throws Exception
BinaryPayloadCodec
Payload
structure from the provided BLOBdecode
in interface BinaryPayloadCodec
buffer
- The buffer to read from, must not be null
null
Exception
- if anything goes wrongCopyright © 2017. All rights reserved.