Interface PacketSender

All Known Subinterfaces:
NetworkChannel, NetworkClient, NetworkComponent, NetworkServer

public interface PacketSender
Represents a source of packets which is connected to a specific target.
Since:
4.0
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Sends the given packet to the associated target.
    default void
    Sends all the given packets to the associated target.
    void
    Sends the given packet to the associated target, waiting for the packet write to the channel to complete before resuming the current thread.
  • Method Details

    • sendPacket

      void sendPacket(@NonNull @NonNull Packet packet)
      Sends the given packet to the associated target.
      Parameters:
      packet - the packet to send.
      Throws:
      NullPointerException - if the packet is null.
    • sendPacketSync

      void sendPacketSync(@NonNull @NonNull Packet packet)
      Sends the given packet to the associated target, waiting for the packet write to the channel to complete before resuming the current thread.
      Parameters:
      packet - the packet to send.
      Throws:
      NullPointerException - if the given packet is null.
    • sendPacket

      default void sendPacket(@NonNull @NonNull Packet... packets)
      Sends all the given packets to the associated target.
      Parameters:
      packets - the packets to send.
      Throws:
      NullPointerException - if the packets are null.