Class DefaultPacketContext

  • All Implemented Interfaces:
    PacketContext

    public abstract class DefaultPacketContext
    extends java.lang.Object
    implements PacketContext
    Default implementation of a packet context.
    • Constructor Detail

      • DefaultPacketContext

        protected DefaultPacketContext​(long time,
                                       InboundPacket inPkt,
                                       OutboundPacket outPkt,
                                       boolean block)
        Creates a new packet context.
        Parameters:
        time - creation time
        inPkt - inbound packet
        outPkt - outbound packet
        block - whether the context is blocked or not
    • Method Detail

      • time

        public long time()
        Description copied from interface: PacketContext
        Returns the time when the packet was received.
        Specified by:
        time in interface PacketContext
        Returns:
        the time in millis since start of epoch
      • send

        public abstract void send()
        Description copied from interface: PacketContext
        Triggers the outbound packet to be sent.
        Specified by:
        send in interface PacketContext
      • block

        public boolean block()
        Description copied from interface: PacketContext
        Blocks the outbound packet from being sent from this point onward.
        Specified by:
        block in interface PacketContext
        Returns:
        whether the outbound packet is blocked.
      • isHandled

        public boolean isHandled()
        Description copied from interface: PacketContext
        Indicates whether the outbound packet is handled, i.e. sent or blocked.
        Specified by:
        isHandled in interface PacketContext
        Returns:
        true uf the packed is handled