Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Attributes | List of all members
io.flutter.plugin.common.BinaryCodec Class Reference
Inheritance diagram for io.flutter.plugin.common.BinaryCodec:
io.flutter.plugin.common.MessageCodec< ByteBuffer >

Public Member Functions

ByteBuffer encodeMessage (@Nullable ByteBuffer message)
 
ByteBuffer decodeMessage (@Nullable ByteBuffer message)
 
- Public Member Functions inherited from io.flutter.plugin.common.MessageCodec< ByteBuffer >
ByteBuffer encodeMessage ( @Nullable T message)
 
T decodeMessage ( @Nullable ByteBuffer message)
 

Static Public Attributes

static final BinaryCodec INSTANCE = new BinaryCodec()
 
static final BinaryCodec INSTANCE_DIRECT = new BinaryCodec(true)
 

Detailed Description

A MessageCodec using unencoded binary messages, represented as ByteBuffers.

This codec is guaranteed to be compatible with the corresponding BinaryCodec on the Dart side. These parts of the Flutter SDK are evolved synchronously.

On the Dart side, messages are represented using ByteData.

Definition at line 19 of file BinaryCodec.java.

Member Function Documentation

◆ decodeMessage()

ByteBuffer io.flutter.plugin.common.BinaryCodec.decodeMessage ( @Nullable ByteBuffer  message)
inline

Definition at line 54 of file BinaryCodec.java.

54 {
55 if (message == null) {
56 return message;
57 } else if (returnsDirectByteBufferFromDecoding) {
58 return message;
59 } else {
60 ByteBuffer result = ByteBuffer.allocate(message.capacity());
61 result.put(message);
62 result.rewind();
63 return result;
64 }
65 }
GAsyncResult * result
Win32Message message

◆ encodeMessage()

ByteBuffer io.flutter.plugin.common.BinaryCodec.encodeMessage ( @Nullable ByteBuffer  message)
inline

Definition at line 49 of file BinaryCodec.java.

49 {
50 return message;
51 }

Member Data Documentation

◆ INSTANCE

final BinaryCodec io.flutter.plugin.common.BinaryCodec.INSTANCE = new BinaryCodec()
static

Definition at line 21 of file BinaryCodec.java.

◆ INSTANCE_DIRECT

final BinaryCodec io.flutter.plugin.common.BinaryCodec.INSTANCE_DIRECT = new BinaryCodec(true)
static

A BinaryCodec that returns direct ByteBuffers from decodeMessage for better performance.

See also
BinaryCodec::BinaryCodec(boolean)

Definition at line 27 of file BinaryCodec.java.


The documentation for this class was generated from the following file: