Package 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 Default Methods Deprecated Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `afterInnerMessageRead​(boolean finished)` | Callback called after inner message is read.
    `void` | `beforeInnerMessageRead()` | Callback called before inner message is read.
    `void` | `incrementState()` | Increments read state.
    `boolean` | `isLastRead()` | Tells whether last invocation of any of `readXXX(...)` methods has fully written the value.
    `org.apache.ignite.internal.processors.affinity.AffinityTopologyVersion` | `readAffinityTopologyVersion()` | Reads `AffinityTopologyVersion`.
    `BitSet` | `readBitSet()` | Reads `BitSet`.
    `boolean` | `readBoolean()` | Reads `boolean` value.
    `boolean[]` | `readBooleanArray()` | Reads `boolean` array.
    `byte` | `readByte()` | Reads `byte` value.
    `byte[]` | `readByteArray()` | Reads `byte` array.
    `org.apache.ignite.internal.processors.cache.CacheObject` | `readCacheObject()` | Reads `CacheObject`.
    `char` | `readChar()` | Reads `char` value.
    `char[]` | `readCharArray()` | Reads `char` array.
    `<C extends Collection<?>> C` | `readCollection​(MessageCollectionItemType itemType)` | Reads any collection.
    `double` | `readDouble()` | Reads `double` value.
    `double[]` | `readDoubleArray()` | Reads `double` array.
    `float` | `readFloat()` | Reads `float` value.
    `float[]` | `readFloatArray()` | Reads `float` array.
    `org.apache.ignite.internal.util.GridLongList` | `readGridLongList()` | Reads `GridLongList`.
    `IgniteUuid` | `readIgniteUuid()` | Reads `IgniteUuid`.
    `int` | `readInt()` | Reads `int` value.
    `int[]` | `readIntArray()` | Reads `int` array.
    `org.apache.ignite.internal.processors.cache.KeyCacheObject` | `readKeyCacheObject()` | Reads `KeyCacheObject`.
    `long` | `readLong()` | Reads `long` value.
    `long[]` | `readLongArray()` | Reads `long` array.
    `<M extends Map<?,​?>> M` | `readMap​(MessageCollectionItemType keyType, MessageCollectionItemType valType, boolean linked)` | Reads map.
    `<T extends Message> T` | `readMessage()` | Reads nested message.
    `<T> T[]` | `readObjectArray​(MessageCollectionItemType itemType, Class<T> itemCls)` | Reads array of objects.
    `<S extends Set<?>> S` | `readSet​(MessageCollectionItemType itemType)` | Reads any collection and provides it as a set.
    `short` | `readShort()` | Reads `short` value.
    `short[]` | `readShortArray()` | Reads `short` array.
    `String` | `readString()` | Reads `String`.
    `UUID` | `readUuid()` | Reads `UUID`.
    `void` | `reset()` | Resets this reader.
    `default void` | `setBuffer​(ByteBuffer buf)` | Deprecated.
    `int` | `state()` | Gets current read state.

- - ### Method Detail

    - #### setBuffer

          @Deprecated
          default void setBuffer​(ByteBuffer buf)

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

    - #### readByte

          byte readByte()

      Reads `byte` value.
      Returns:
        `byte` value.

    - #### readShort

          short readShort()

      Reads `short` value.
      Returns:
        `short` value.

    - #### readInt

          int readInt()

      Reads `int` value.
      Returns:
        `int` value.

    - #### readLong

          long readLong()

      Reads `long` value.
      Returns:
        `long` value.

    - #### readFloat

          float readFloat()

      Reads `float` value.
      Returns:
        `float` value.

    - #### readDouble

          double readDouble()

      Reads `double` value.
      Returns:
        `double` value.

    - #### readChar

          char readChar()

      Reads `char` value.
      Returns:
        `char` value.

    - #### readBoolean

          boolean readBoolean()

      Reads `boolean` value.
      Returns:
        `boolean` value.

    - #### readByteArray

          byte[] readByteArray()

      Reads `byte` array.
      Returns:
        `byte` array.

    - #### readShortArray

          short[] readShortArray()

      Reads `short` array.
      Returns:
        `short` array.

    - #### readIntArray

          int[] readIntArray()

      Reads `int` array.
      Returns:
        `int` array.

    - #### readLongArray

          long[] readLongArray()

      Reads `long` array.
      Returns:
        `long` array.

    - #### readFloatArray

          float[] readFloatArray()

      Reads `float` array.
      Returns:
        `float` array.

    - #### readDoubleArray

          double[] readDoubleArray()

      Reads `double` array.
      Returns:
        `double` array.

    - #### readCharArray

          char[] readCharArray()

      Reads `char` array.
      Returns:
        `char` array.

    - #### readBooleanArray

          boolean[] readBooleanArray()

      Reads `boolean` array.
      Returns:
        `boolean` array.

    - #### readString

          String readString()

      Reads `String`.
      Returns:
        `String`.

    - #### readBitSet

          BitSet readBitSet()

      Reads `BitSet`.
      Returns:
        `BitSet`.

    - #### readUuid

          UUID readUuid()

      Reads `UUID`.
      Returns:
        `UUID`.

    - #### readIgniteUuid

          IgniteUuid readIgniteUuid()

      Reads `IgniteUuid`.
      Returns:
        `IgniteUuid`.

    - #### readAffinityTopologyVersion

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

      Reads `AffinityTopologyVersion`.
      Returns:
        `AffinityTopologyVersion`.

    - #### readMessage

          <T extends Message> T readMessage()

      Reads nested message.
      Type Parameters:
        `T` - Type of the message.
      Returns:
        Message.

    - #### readCacheObject

          org.apache.ignite.internal.processors.cache.CacheObject readCacheObject()

      Reads `CacheObject`.
      Returns:
        Cache object.

    - #### readKeyCacheObject

          org.apache.ignite.internal.processors.cache.KeyCacheObject readKeyCacheObject()

      Reads `KeyCacheObject`.
      Returns:
        Key cache object.

    - #### readGridLongList

          org.apache.ignite.internal.util.GridLongList readGridLongList()

      Reads `GridLongList`.
      Returns:
        Grid long list.

    - #### readObjectArray

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

      Reads array of objects.
      Type Parameters:
        `T` - Type of the read object.
      Parameters:
        `itemType` - Array component type.
        `itemCls` - Array component class.
      Returns:
        Array of objects.

    - #### readCollection

          <C extends Collection<?>> C readCollection​(MessageCollectionItemType itemType)

      Reads any collection.
      Type Parameters:
        `C` - Type of the read collection.
      Parameters:
        `itemType` - Collection item type.
      Returns:
        Collection.

    - #### readSet

          <S extends Set<?>> S readSet​(MessageCollectionItemType itemType)

      Reads any collection and provides it as a set.
      Type Parameters:
        `S` - Type of the read set.
      Parameters:
        `itemType` - Set item type.
      Returns:
        Set.

    - #### readMap

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

      Reads map.
      Type Parameters:
        `M` - Type of the read map.
      Parameters:
        `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.