Class PongPacketHandler

java.lang.Object
crow.game.examples.pingpong.proto.PongPacketHandler
All Implemented Interfaces:
PacketHandler<Pong>

public class PongPacketHandler extends Object implements PacketHandler<Pong>
This is the packet handler for the Pong message. It, ironically, is empty since Pong is a 0-byte message (ignoring packet id) so this handler is only responsible for constructing and defining the packet details.
  • Constructor Details

    • PongPacketHandler

      public PongPacketHandler()
  • Method Details

    • fromPacket

      public Pong fromPacket(Context ctx, PacketReader buffer)
      Description copied from interface: PacketHandler
      Convert the given buffer to the type.
      Specified by:
      fromPacket in interface PacketHandler<Pong>
      Parameters:
      ctx - The calling context.
      buffer - The input buffer stream reader.
      Returns:
      The POJO object
    • toPacket

      public void toPacket(Context ctx, io.netty.buffer.ByteBuf buffer, Pong src)
      Description copied from interface: PacketHandler
      Writes the object of type T to the byte buffer.
      Specified by:
      toPacket in interface PacketHandler<Pong>
      Parameters:
      ctx - The calling context.
      buffer - The destination buffer.
      src - The source object we are converting.
    • rule

      public PacketRule rule(Context ctx)
      Specified by:
      rule in interface PacketHandler<Pong>
      Parameters:
      ctx - The calling context.
      Returns:
      The packet rule object which specifies when this packet handler should be called.
      See Also: