org.apache.ignite.plugin.extensions.communication

## Interface MessageReader

-     public interface MessageReader

  Communication message reader.

  Allows to customize the binary format of communication messages.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `afterInnerMessageRead(boolean finished)` Callback called after inner message is read.
    `boolean` | `afterMessageRead(Class<? extends Message> msgCls)` Callback that must be invoked by a message implementation after message body finished decoding.
    `void` | `beforeInnerMessageRead()` Callback called before inner message is read.
    `boolean` | `beforeMessageRead()` Callback that must be invoked by a message implementation before message body started decoding.
    `void` | `incrementState()` Increments read state.
    `boolean` | `isLastRead()` Tells whether last invocation of any of `readXXX(...)`
    `org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion` | `readAffinityTopologyVersion(String name)` Reads `AffinityTopologyVersion`.
    `BitSet` | `readBitSet(String name)` Reads `BitSet`.
    `boolean` | `readBoolean(String name)` Reads `boolean` value.
    `boolean[]` | `readBooleanArray(String name)` Reads `boolean` array.
    `byte` | `readByte(String name)` Reads `byte` value.
    `byte[]` | `readByteArray(String name)` Reads `byte` array.
    `char` | `readChar(String name)` Reads `char` value.
    `char[]` | `readCharArray(String name)` Reads `char` array.
    `<C extends Collection<?>> C` | `readCollection(String name, MessageCollectionItemType itemType)` Reads collection.
    `double` | `readDouble(String name)` Reads `double` value.
    `double[]` | `readDoubleArray(String name)` Reads `double` array.
    `float` | `readFloat(String name)` Reads `float` value.
    `float[]` | `readFloatArray(String name)` Reads `float` array.
    `IgniteUuid` | `readIgniteUuid(String name)` Reads `IgniteUuid`.
    `int` | `readInt(String name)` Reads `int` value.
    `int` | `readInt(String name, int dflt)` Reads `int` value.
    `int[]` | `readIntArray(String name)` Reads `int` array.
    `long` | `readLong(String name)` Reads `long` value.
    `long[]` | `readLongArray(String name)` Reads `long` array.
    `<M extends Map<?,?>> M` | `readMap(String name, MessageCollectionItemType keyType, MessageCollectionItemType valType, boolean linked)` Reads map.
    `<T extends Message> T` | `readMessage(String name)` Reads nested message.
    `<T> T[]` | `readObjectArray(String name, MessageCollectionItemType itemType, Class<T> itemCls)` Reads array of objects.
    `short` | `readShort(String name)` Reads `short` value.
    `short[]` | `readShortArray(String name)` Reads `short` array.
    `String` | `readString(String name)` Reads `String`.
    `UUID` | `readUuid(String name)` Reads `UUID`.
    `void` | `reset()` Resets this reader.
    `void` | `setBuffer(ByteBuffer buf)` Sets but buffer to read from.
    `void` | `setCurrentReadClass(Class<? extends Message> msgCls)` Sets type of message currently read.
    `int` | `state()` Gets current read state.

- - ### Method Detail

    - #### setBuffer

          void setBuffer(ByteBuffer buf)

      Sets but buffer to read from.
      Parameters:
        `buf` - Byte buffer.

    - #### setCurrentReadClass

          void setCurrentReadClass(Class<? extends Message> msgCls)

      Sets type of message currently read.
      Parameters:
        `msgCls` - Message type.

    - #### beforeMessageRead

          boolean beforeMessageRead()

      Callback that must be invoked by a message implementation before message body started decoding.
      Returns:
        `True` if reading can proceed, `false` otherwise.

    - #### afterMessageRead

          boolean afterMessageRead(Class<? extends Message> msgCls)

      Callback that must be invoked by a message implementation after message body finished decoding.
      Parameters:
        `msgCls` - Message class finishing read stage.
      Returns:
        `True` if reading can proceed, `false` otherwise.

    - #### readByte

          byte readByte(String name)

      Reads `byte` value.
      Parameters:
        `name` - Field name.
      Returns:
        `byte` value.

    - #### readShort

          short readShort(String name)

      Reads `short` value.
      Parameters:
        `name` - Field name.
      Returns:
        `short` value.

    - #### readInt

          int readInt(String name)

      Reads `int` value.
      Parameters:
        `name` - Field name.
      Returns:
        `int` value.

    - #### readInt

          int readInt(String name,
                      int dflt)

      Reads `int` value.
      Parameters:
        `name` - Field name.
        `dflt` - Default value if field not found.
      Returns:
        `int` value.

    - #### readLong

          long readLong(String name)

      Reads `long` value.
      Parameters:
        `name` - Field name.
      Returns:
        `long` value.

    - #### readFloat

          float readFloat(String name)

      Reads `float` value.
      Parameters:
        `name` - Field name.
      Returns:
        `float` value.

    - #### readDouble

          double readDouble(String name)

      Reads `double` value.
      Parameters:
        `name` - Field name.
      Returns:
        `double` value.

    - #### readChar

          char readChar(String name)

      Reads `char` value.
      Parameters:
        `name` - Field name.
      Returns:
        `char` value.

    - #### readBoolean

          boolean readBoolean(String name)

      Reads `boolean` value.
      Parameters:
        `name` - Field name.
      Returns:
        `boolean` value.

    - #### readByteArray

          byte[] readByteArray(String name)

      Reads `byte` array.
      Parameters:
        `name` - Field name.
      Returns:
        `byte` array.

    - #### readShortArray

          short[] readShortArray(String name)

      Reads `short` array.
      Parameters:
        `name` - Field name.
      Returns:
        `short` array.

    - #### readIntArray

          int[] readIntArray(String name)

      Reads `int` array.
      Parameters:
        `name` - Field name.
      Returns:
        `int` array.

    - #### readLongArray

          long[] readLongArray(String name)

      Reads `long` array.
      Parameters:
        `name` - Field name.
      Returns:
        `long` array.

    - #### readFloatArray

          float[] readFloatArray(String name)

      Reads `float` array.
      Parameters:
        `name` - Field name.
      Returns:
        `float` array.

    - #### readDoubleArray

          double[] readDoubleArray(String name)

      Reads `double` array.
      Parameters:
        `name` - Field name.
      Returns:
        `double` array.

    - #### readCharArray

          char[] readCharArray(String name)

      Reads `char` array.
      Parameters:
        `name` - Field name.
      Returns:
        `char` array.

    - #### readBooleanArray

          boolean[] readBooleanArray(String name)

      Reads `boolean` array.
      Parameters:
        `name` - Field name.
      Returns:
        `boolean` array.

    - #### readString

          String readString(String name)

      Reads `String`.
      Parameters:
        `name` - Field name.
      Returns:
        `String`.

    - #### readBitSet

          BitSet readBitSet(String name)

      Reads `BitSet`.
      Parameters:
        `name` - Field name.
      Returns:
        `BitSet`.

    - #### readUuid

          UUID readUuid(String name)

      Reads `UUID`.
      Parameters:
        `name` - Field name.
      Returns:
        `UUID`.

    - #### readIgniteUuid

          IgniteUuid readIgniteUuid(String name)

      Reads `IgniteUuid`.
      Parameters:
        `name` - Field name.
      Returns:
        `IgniteUuid`.

    - #### readAffinityTopologyVersion

          org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion readAffinityTopologyVersion(String name)

      Reads `AffinityTopologyVersion`.
      Parameters:
        `name` - Field name.
      Returns:
        `AffinityTopologyVersion`.

    - #### readMessage

          <T extends Message> T readMessage(String name)

      Reads nested message.
      Parameters:
        `name` - Field name.
      Returns:
        Message.

    - #### readObjectArray

          <T> T[] readObjectArray(String name,
                                  MessageCollectionItemType itemType,
                                  Class<T> itemCls)

      Reads array of objects.
      Parameters:
        `name` - Field name.
        `itemType` - Array component type.
        `itemCls` - Array component class.
      Returns:
        Array of objects.

    - #### readCollection

          <C extends Collection<?>> C readCollection(String name,
                                                     MessageCollectionItemType itemType)

      Reads collection.
      Parameters:
        `name` - Field name.
        `itemType` - Collection item type.
      Returns:
        Collection.

    - #### readMap

          <M extends Map<?,?>> M readMap(String name,
                                         MessageCollectionItemType keyType,
                                         MessageCollectionItemType valType,
                                         boolean linked)

      Reads map.
      Parameters:
        `name` - Field name.
        `keyType` - Map key type.
        `valType` - Map value type.
        `linked` - Whether `LinkedHashMap` should be created.
      Returns:
        Map.

    - #### isLastRead

          boolean isLastRead()

      Tells whether last invocation of any of `readXXX(...)` methods has fully written the value. `False` is returned if there were not enough remaining bytes in byte buffer.
      Returns:
        Whether las value was fully read.

    - #### state

          int state()

      Gets current read state.
      Returns:
        Read state.

    - #### incrementState

          void incrementState()

      Increments read state.

    - #### beforeInnerMessageRead

          void beforeInnerMessageRead()

      Callback called before inner message is read.

    - #### afterInnerMessageRead

          void afterInnerMessageRead(boolean finished)

      Callback called after inner message is read.
      Parameters:
        `finished` - Whether message was fully read.

    - #### reset

          void reset()

      Resets this reader.

2021 Copyright © Apache Software Foundation
| Follow @ApacheIgnite
Ignite Database and Caching Platform | : ver. 2.11.0
Release Date | : September 11 2021