public final class JSONMessageCodec extends Object implements MessageCodec<Object>
MessageCodec
using UTF-8 encoded JSON messages.
This codec is guaranteed to be compatible with the corresponding JSONMessageCodec on the Dart side. These parts of the Flutter SDK are evolved synchronously.
Supports the same Java values as JSONObject.wrap(Object)
.
On the Dart side, JSON messages are handled by the JSON facilities of the dart:convert package.
Modifier and Type | Field and Description |
---|---|
static JSONMessageCodec |
INSTANCE |
Modifier and Type | Method and Description |
---|---|
Object |
decodeMessage(ByteBuffer message)
Decodes the specified message from binary.
|
ByteBuffer |
encodeMessage(Object message)
Encodes the specified message into binary.
|
public static final JSONMessageCodec INSTANCE
public ByteBuffer encodeMessage(Object message)
MessageCodec
encodeMessage
in interface MessageCodec<Object>
message
- the T message, possibly null.public Object decodeMessage(ByteBuffer message)
MessageCodec
decodeMessage
in interface MessageCodec<Object>
message
- the ByteBuffer
message, possibly null.