Class CachedPacket<T extends Packet>

java.lang.Object
com.hypixel.hytale.protocol.CachedPacket<T>
All Implemented Interfaces:
Packet, AutoCloseable

public final class CachedPacket<T extends Packet> extends Object implements Packet, AutoCloseable
  • Field Details

    • packetType

      private final Class<T extends Packet> packetType
    • packetId

      private final int packetId
    • cachedBytes

      private final io.netty.buffer.ByteBuf cachedBytes
  • Constructor Details

    • CachedPacket

      private CachedPacket(Class<T> packetType, int packetId, io.netty.buffer.ByteBuf cachedBytes)
  • Method Details

    • cache

      public static <T extends Packet> CachedPacket<T> cache(@Nonnull T packet)
    • getId

      public int getId()
      Specified by:
      getId in interface Packet
    • serialize

      public void serialize(@Nonnull io.netty.buffer.ByteBuf buf)
      Specified by:
      serialize in interface Packet
    • computeSize

      public int computeSize()
      Specified by:
      computeSize in interface Packet
    • getPacketType

      public Class<T> getPacketType()
    • getCachedSize

      public int getCachedSize()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable