Class FileChunkedPacketSenderBuilder

java.lang.Object
eu.cloudnetservice.driver.network.chunk.defaults.builder.DefaultChunkedPacketSenderBuilder
eu.cloudnetservice.driver.network.chunk.defaults.builder.FileChunkedPacketSenderBuilder
All Implemented Interfaces:
ChunkedPacketSender.Builder

public class FileChunkedPacketSenderBuilder extends DefaultChunkedPacketSenderBuilder
Represents a builder for chunked packet sessions which are transferring files.
Since:
4.0
See Also:
  • Constructor Details

    • FileChunkedPacketSenderBuilder

      public FileChunkedPacketSenderBuilder()
  • Method Details

    • forFile

      Sets the file to transfer in the session. The file path must exist.
      Parameters:
      path - the path to the file to transfer.
      Returns:
      the same builder instance as used to call the method, for chaining.
      Throws:
      AssertionError - if an i/o error occurs while opening the file stream.
      NullPointerException - if the given file path is null.
    • doBuild

      @NonNull protected @NonNull ChunkedPacketSender doBuild()
      Delegate method which must get overridden by any class which extends from this builder. The method is used to actually build the sender while being sure that there are no violations to the build contract (the delegation method should, but must not be assertion free).
      Specified by:
      doBuild in class DefaultChunkedPacketSenderBuilder
      Returns:
      the sender instance build based on the information supplied to this builder.