Package nl.vpro.util

Class Copier.Builder

java.lang.Object
nl.vpro.util.Copier.Builder
Enclosing class:
Copier

public static class Copier.Builder extends Object
  • Method Details

    • input

      public Copier.Builder input(@NonNull InputStream input)
      Parameters:
      input - The input stream to copy from (will be closed if ready)
      Returns:
      this.
    • expectedCount

      public Copier.Builder expectedCount(@Nullable Long expectedCount)
      Returns:
      this.
    • output

      public Copier.Builder output(@NonNull OutputStream output)
      Parameters:
      output - The output stream to copy to (will not be implicetely closed)
      Returns:
      this.
    • batch

      public Copier.Builder batch(Long batch)
      Parameters:
      batch - The size of batches (defaults to 8192)
      Returns:
      this.
    • batchConsumer

      public Copier.Builder batchConsumer(@Nullable Consumer<Copier> batchConsumer)
      Parameters:
      batchConsumer - Some action to perform after each batch
      Returns:
      this.
    • consumeSize

      public Copier.Builder consumeSize(Long consumeSize)
      Returns:
      this.
    • callback

      public Copier.Builder callback(@Nullable Consumer<Copier> callback)
      Parameters:
      callback - Called when ready, this should probably close the outputstream
      Returns:
      this.
    • errorHandler

      public Copier.Builder errorHandler(@Nullable BiConsumer<Copier,Throwable> errorHandler)
      Parameters:
      errorHandler - Called on error, just before callback
      Returns:
      this.
    • offset

      public Copier.Builder offset(int offset)
      Parameters:
      offset - Just the initial value for Copier.getCount()
      Returns:
      this.
    • name

      public Copier.Builder name(@Nullable String name)
      Parameters:
      name - A name to assign to this copier
      Returns:
      this.
    • notify

      public Copier.Builder notify(@Nullable Object notify)
      Returns:
      this.
    • executorService

      public Copier.Builder executorService(@Nullable ExecutorService executorService)
      Returns:
      this.
    • build

      public Copier build()
    • toString

      public String toString()
      Overrides:
      toString in class Object