Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
io.flutter.plugin.common.MessageCodec< T > Interface Template Reference

Public Member Functions

ByteBuffer encodeMessage (@Nullable T message)
 
T decodeMessage (@Nullable ByteBuffer message)
 

Detailed Description

A message encoding/decoding mechanism.

Both operations throw IllegalArgumentException, if conversion fails.

Definition at line 15 of file MessageCodec.java.

Member Function Documentation

◆ decodeMessage()

T io.flutter.plugin.common.MessageCodec< T >.decodeMessage ( @Nullable ByteBuffer  message)

Decodes the specified message from binary.

Warning: The ByteBuffer is "direct" and it won't be valid beyond this call. Storing the ByteBuffer and using it later and will lead to a java.nio.BufferUnderflowException. If you want to retain the data you'll need to copy it.

Parameters
messagethe ByteBuffer message, possibly null.
Returns
a T value representation of the bytes between the given buffer's current position and its limit, or null, if message is null.

◆ encodeMessage()

ByteBuffer io.flutter.plugin.common.MessageCodec< T >.encodeMessage ( @Nullable T  message)

Encodes the specified message into binary.

Parameters
messagethe T message, possibly null.
Returns
a ByteBuffer containing the encoding between position 0 and the current position, or null, if message is null.

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