cpw.mods.fml.common.network

## Class FMLIndexedMessageToMessageCodec<A>

- java.lang.Object
- - io.netty.channel.ChannelHandlerAdapter
  - - io.netty.channel.ChannelInboundHandlerAdapter
    - - io.netty.channel.ChannelDuplexHandler
      - - io.netty.handler.codec.MessageToMessageCodec<FMLProxyPacket,A>
        - - cpw.mods.fml.common.network.FMLIndexedMessageToMessageCodec<A>

- All Implemented Interfaces:
    io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler, io.netty.channel.ChannelOutboundHandler
  Direct Known Subclasses:
    FMLHandshakeCodec, FMLRuntimeCodec, ForgeRuntimeCodec, SimpleIndexedCodec

      @ChannelHandler.Sharable
      public abstract class FMLIndexedMessageToMessageCodec<A>
      extends io.netty.handler.codec.MessageToMessageCodec<FMLProxyPacket,A>

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

      `io.netty.channel.ChannelHandler.Sharable`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static io.netty.util.AttributeKey<java.lang.ThreadLocal<java.lang.ref.WeakReference<FMLProxyPacket>>>` | `INBOUNDPACKETTRACKER` Make this accessible to subclasses

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `FMLIndexedMessageToMessageCodec()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `FMLIndexedMessageToMessageCodec<A>` | `addDiscriminator(int discriminator, java.lang.Class<? extends A> type)`
    `protected void` | `decode(io.netty.channel.ChannelHandlerContext ctx, FMLProxyPacket msg, java.util.List<java.lang.Object> out)`
    `abstract void` | `decodeInto(io.netty.channel.ChannelHandlerContext ctx, io.netty.buffer.ByteBuf source, A msg)`
    `protected void` | `encode(io.netty.channel.ChannelHandlerContext ctx, A msg, java.util.List<java.lang.Object> out)`
    `abstract void` | `encodeInto(io.netty.channel.ChannelHandlerContext ctx, A msg, io.netty.buffer.ByteBuf target)`
    `void` | `exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, java.lang.Throwable cause)`
    `void` | `handlerAdded(io.netty.channel.ChannelHandlerContext ctx)`
    `protected void` | `testMessageValidity(FMLProxyPacket msg)` Called to verify the message received.

    - ### Methods inherited from class io.netty.handler.codec.MessageToMessageCodec

      `acceptInboundMessage, acceptOutboundMessage, channelRead, write`

    - ### Methods inherited from class io.netty.channel.ChannelDuplexHandler

      `bind, close, connect, deregister, disconnect, flush, read`

    - ### Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

      `channelActive, channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered`

    - ### Methods inherited from class io.netty.channel.ChannelHandlerAdapter

      `handlerRemoved, isSharable`

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

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

    - ### Methods inherited from interface io.netty.channel.ChannelHandler

      `handlerRemoved`

- - ### Field Detail

    - #### INBOUNDPACKETTRACKER

          public static final io.netty.util.AttributeKey<java.lang.ThreadLocal<java.lang.ref.WeakReference<FMLProxyPacket>>> INBOUNDPACKETTRACKER

      Make this accessible to subclasses

  - ### Constructor Detail

    - #### FMLIndexedMessageToMessageCodec

          public FMLIndexedMessageToMessageCodec()

  - ### Method Detail

    - #### handlerAdded

          public void handlerAdded(io.netty.channel.ChannelHandlerContext ctx)
                            throws java.lang.Exception

      Specified by:
        `handlerAdded` in interface `io.netty.channel.ChannelHandler`
      Overrides:
        `handlerAdded` in class `io.netty.channel.ChannelHandlerAdapter`
      Throws:
        `java.lang.Exception`

    - #### addDiscriminator

          public FMLIndexedMessageToMessageCodec<A> addDiscriminator(int discriminator,
                                                            java.lang.Class<? extends A> type)

    - #### encodeInto

          public abstract void encodeInto(io.netty.channel.ChannelHandlerContext ctx,
                        A msg,
                        io.netty.buffer.ByteBuf target)
                                   throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### encode

          protected final void encode(io.netty.channel.ChannelHandlerContext ctx,
                    A msg,
                    java.util.List<java.lang.Object> out)
                               throws java.lang.Exception

      Specified by:
        `encode` in class `io.netty.handler.codec.MessageToMessageCodec<FMLProxyPacket,A>`
      Throws:
        `java.lang.Exception`

    - #### decodeInto

          public abstract void decodeInto(io.netty.channel.ChannelHandlerContext ctx,
                        io.netty.buffer.ByteBuf source,
                        A msg)

    - #### decode

          protected final void decode(io.netty.channel.ChannelHandlerContext ctx,
                    FMLProxyPacket msg,
                    java.util.List<java.lang.Object> out)
                               throws java.lang.Exception

      Specified by:
        `decode` in class `io.netty.handler.codec.MessageToMessageCodec<FMLProxyPacket,A>`
      Throws:
        `java.lang.Exception`

    - #### testMessageValidity

          protected void testMessageValidity(FMLProxyPacket msg)

      Called to verify the message received. This can be used to hard disconnect in case of an unexpected packet, say due to a weird protocol mismatch. Use with caution.
      Parameters:
        `msg` -

    - #### exceptionCaught

          public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx,
                             java.lang.Throwable cause)
                               throws java.lang.Exception

      Specified by:
        `exceptionCaught` in interface `io.netty.channel.ChannelHandler`
      Specified by:
        `exceptionCaught` in interface `io.netty.channel.ChannelInboundHandler`
      Overrides:
        `exceptionCaught` in class `io.netty.channel.ChannelInboundHandlerAdapter`
      Throws:
        `java.lang.Exception`