Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
io.flutter.plugin.common.MethodCodec Interface Reference
Inheritance diagram for io.flutter.plugin.common.MethodCodec:
io.flutter.plugin.common.JSONMethodCodec io.flutter.plugin.common.StandardMethodCodec

Public Member Functions

ByteBuffer encodeMethodCall (@NonNull MethodCall methodCall)
 
MethodCall decodeMethodCall (@NonNull ByteBuffer methodCall)
 
ByteBuffer encodeSuccessEnvelope (@Nullable Object result)
 
ByteBuffer encodeErrorEnvelope ( @NonNull String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails)
 
ByteBuffer encodeErrorEnvelopeWithStacktrace ( @NonNull String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails, @Nullable String errorStacktrace)
 
Object decodeEnvelope (@NonNull ByteBuffer envelope)
 

Detailed Description

A codec for method calls and enveloped results.

Method calls are encoded as binary messages with enough structure that the codec can extract a method name String and an arguments Object. These data items are used to populate a MethodCall.

All operations throw IllegalArgumentException, if conversion fails.

Definition at line 20 of file MethodCodec.java.

Member Function Documentation

◆ decodeEnvelope()

Object io.flutter.plugin.common.MethodCodec.decodeEnvelope ( @NonNull ByteBuffer  envelope)

Decodes a result envelope from binary.

Parameters
envelopethe binary encoding of a result envelope as a ByteBuffer.
Returns
the enveloped result Object.
Exceptions
FlutterExceptionif the envelope was an error envelope.

Implemented in io.flutter.plugin.common.JSONMethodCodec, and io.flutter.plugin.common.StandardMethodCodec.

◆ decodeMethodCall()

MethodCall io.flutter.plugin.common.MethodCodec.decodeMethodCall ( @NonNull ByteBuffer  methodCall)

Decodes a message call from binary.

Parameters
methodCallthe binary encoding of the method call as a ByteBuffer.
Returns
a MethodCall representation of the bytes between the given buffer's current position and its limit.

Implemented in io.flutter.plugin.common.JSONMethodCodec, and io.flutter.plugin.common.StandardMethodCodec.

◆ encodeErrorEnvelope()

ByteBuffer io.flutter.plugin.common.MethodCodec.encodeErrorEnvelope ( @NonNull String  errorCode,
@Nullable String  errorMessage,
@Nullable Object  errorDetails 
)

Encodes an error result into a binary envelope message.

Parameters
errorCodeAn error code String.
errorMessageAn error message String, possibly null.
errorDetailsError details, possibly null. Consider supporting Throwable in your codec. This is the most common value passed to this field.
Returns
a ByteBuffer containing the encoding between position 0 and the current position.

Implemented in io.flutter.plugin.common.JSONMethodCodec.

◆ encodeErrorEnvelopeWithStacktrace()

ByteBuffer io.flutter.plugin.common.MethodCodec.encodeErrorEnvelopeWithStacktrace ( @NonNull String  errorCode,
@Nullable String  errorMessage,
@Nullable Object  errorDetails,
@Nullable String  errorStacktrace 
)

Encodes an error result into a binary envelope message with the native stacktrace.

Parameters
errorCodeAn error code String.
errorMessageAn error message String, possibly null.
errorDetailsError details, possibly null. Consider supporting Throwable in your codec. This is the most common value passed to this field.
errorStacktracePlatform stacktrace for the error. possibly null.
Returns
a ByteBuffer containing the encoding between position 0 and the current position.

Implemented in io.flutter.plugin.common.JSONMethodCodec.

◆ encodeMethodCall()

ByteBuffer io.flutter.plugin.common.MethodCodec.encodeMethodCall ( @NonNull MethodCall  methodCall)

Encodes a message call into binary.

Parameters
methodCalla MethodCall.
Returns
a ByteBuffer containing the encoding between position 0 and the current position.

Implemented in io.flutter.plugin.common.JSONMethodCodec, and io.flutter.plugin.common.StandardMethodCodec.

◆ encodeSuccessEnvelope()

ByteBuffer io.flutter.plugin.common.MethodCodec.encodeSuccessEnvelope ( @Nullable Object  result)

Encodes a successful result into a binary envelope message.

Parameters
resultThe result value, possibly null.
Returns
a ByteBuffer containing the encoding between position 0 and the current position.

Implemented in io.flutter.plugin.common.JSONMethodCodec.


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