io.flutter.plugin.common

## Class BinaryCodec

- java.lang.Object
- - io.flutter.plugin.common.BinaryCodec

- All Implemented Interfaces:
    MessageCodec<ByteBuffer>

      public final class BinaryCodec
      extends Object
      implements MessageCodec<ByteBuffer>

  A `MessageCodec` using unencoded binary messages, represented as `ByteBuffer`s.

  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`.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static BinaryCodec` | `INSTANCE`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ByteBuffer` | `decodeMessage(ByteBuffer message)` Decodes the specified message from binary.
    `ByteBuffer` | `encodeMessage(ByteBuffer message)` Encodes the specified message into binary.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### INSTANCE

          public static final BinaryCodec INSTANCE

  - ### Method Detail

    - #### encodeMessage

          public ByteBuffer encodeMessage(ByteBuffer message)

      Description copied from interface: `MessageCodec`
      Encodes the specified message into binary.
      Specified by:
        `encodeMessage` in interface `MessageCodec<ByteBuffer>`
      Parameters:
        `message` - the T message, possibly null.
      Returns:
        a ByteBuffer containing the encoding between position 0 and the current position, or null, if message is null.

    - #### decodeMessage

          public ByteBuffer decodeMessage(ByteBuffer message)

      Description copied from interface: `MessageCodec`
      Decodes the specified message from binary.
      Specified by:
        `decodeMessage` in interface `MessageCodec<ByteBuffer>`
      Parameters:
        `message` - the `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.