Class ChunkedPacketSessionOpenEvent

java.lang.Object
eu.cloudnetservice.driver.event.Event
eu.cloudnetservice.driver.network.chunk.event.ChunkedPacketSessionOpenEvent

public final class ChunkedPacketSessionOpenEvent extends Event
Called when a chunked packet transfer to the current network component was requested and is about to start. This event is used in combination with the event chunk handler factory which is calling this event to determine which handler should be used for the transfer. If no handler gets set by any listener this results in an exception and prevents the chunk handling transfer from happening. If the event based solution is not used as the factory, this event will (by default) never get fired.
Since:
4.0
  • Field Details

  • Constructor Details

    • ChunkedPacketSessionOpenEvent

      public ChunkedPacketSessionOpenEvent(@NonNull @NonNull ChunkSessionInformation sessionInformation)
      Constructs a new chunked packet session open event with the given session information as the reason for it to get fired.
      Parameters:
      sessionInformation - the chunked transfer session information.
      Throws:
      NullPointerException - if the given session information is null.
  • Method Details

    • session

      Get the session information about the chunked transfer that was requested. Further data will only contain some information to identify itself.
      Returns:
      the session information about the chunked transfer that was requested.
    • handler

      Get the handler which should be used to open the session. If no handler is defined then the transfer will not happen and an exception will be thrown to indicate that the handler is missing.
      Returns:
      the handler which should be used to open the session.
    • handler

      public void handler(@Nullable @Nullable ChunkedPacketHandler chunkedPacketHandler)
      Sets the handler which should be used to open session. Null is an accepted value and will result in the factory to not be set. If the factory is not set after all listeners were called, the transfer of the chunked data will not happen and an exception will be thrown to indicate that.
      Parameters:
      chunkedPacketHandler - the handler for the session to use.