Package nl.vpro.util
Class Copier.Builder
- java.lang.Object
-
- nl.vpro.util.Copier.Builder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Copier.Builder
batch(long batch)
Copier.Builder
batchConsumer(@Nullable Consumer<Copier> batchConsumer)
Copier
build()
Copier.Builder
callback(@Nullable Consumer<Copier> callback)
Copier.Builder
errorHandler(@Nullable BiConsumer<Copier,Throwable> errorHandler)
Copier.Builder
expectedCount(@Nullable Long expectedCount)
Copier.Builder
input(@NonNull InputStream input)
Copier.Builder
name(@Nullable String name)
Copier.Builder
notify(@Nullable Object notify)
Copier.Builder
offset(int offset)
Copier.Builder
output(@NonNull OutputStream output)
String
toString()
-
-
-
Method Detail
-
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
.
-
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 forCopier.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
.
-
build
public Copier build()
-
-