com.hazelcast.nio.tcp

## Class PacketDecoder

- java.lang.Object
- - com.hazelcast.internal.networking.nio.ChannelInboundHandlerWithCounters
  - - com.hazelcast.nio.tcp.PacketDecoder

- All Implemented Interfaces:
    com.hazelcast.internal.networking.ChannelInboundHandler

      public class PacketDecoder
      extends com.hazelcast.internal.networking.nio.ChannelInboundHandlerWithCounters

  The `ChannelInboundHandler` for member to member communication. It reads as many packets from the src ByteBuffer as possible, and each of the Packets is send to the `PacketHandler`.
  See Also:
    `PacketHandler`, `PacketEncoder`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected TcpIpConnection` | `connection`

    - ### Fields inherited from class com.hazelcast.internal.networking.nio.ChannelInboundHandlerWithCounters

      `normalPacketsRead, priorityPacketsRead`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `PacketDecoder(TcpIpConnection connection, com.hazelcast.spi.impl.PacketHandler handler)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `onPacketComplete(Packet packet)`
    `void` | `onRead(ByteBuffer src)` A callback to indicate that data is available in the src ByteBuffer to be processed.

    - ### Methods inherited from class com.hazelcast.internal.networking.nio.ChannelInboundHandlerWithCounters

      `setNormalPacketsRead, setPriorityPacketsRead`

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

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

- - ### Field Detail

    - #### connection

          protected final TcpIpConnection connection

  - ### Constructor Detail

    - #### PacketDecoder

          public PacketDecoder(TcpIpConnection connection,
                               com.hazelcast.spi.impl.PacketHandler handler)

  - ### Method Detail

    - #### onRead

          public void onRead(ByteBuffer src)
                      throws Exception

      Description copied from interface: `com.hazelcast.internal.networking.ChannelInboundHandler`
      A callback to indicate that data is available in the src ByteBuffer to be processed.
      Parameters:
        `src` - the ByteBuffer containing the data to read. The ByteBuffer is already in reading mode and when completed, should not be converted to write-mode using clear/compact.
      Throws:
        `Exception` - if something fails while reading data from the ByteBuffer or processing the data (e.g. when a Packet fails to get processed). When an exception is thrown, the `ChannelErrorHandler` is called.

    - #### onPacketComplete

          protected void onPacketComplete(Packet packet)
                                   throws Exception

      Throws:
        `Exception`

Copyright © 2018. All rights reserved.