Class OutputSequenceIncrementing<T>
Object
OutputSequenceIncrementing<T>
- Type Parameters:
T
- element-type in generator
A sequence of outputs that use the same generator, where each output increments an index by one
in the filename.
- Author:
- Owen Feehan
-
Constructor Summary
ConstructorsConstructorDescriptionOutputSequenceIncrementing
(BoundOutputter<T> outputter) Create with an outputter. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Outputs an additional element in the sequence.addAsynchronously
(T element) Likeadd(Object)
but does not immediately execute the underlying add operation, instead returning an operation that can be called later.
-
Constructor Details
-
OutputSequenceIncrementing
Create with an outputter.- Parameters:
outputter
- the outputter.- Throws:
OutputWriteFailedException
- if missing ingredients for outputting, or if unable to initialize.
-
-
Method Details
-
add
Outputs an additional element in the sequence.This method is thread-safe.
- Parameters:
element
- the element to add.- Throws:
OutputWriteFailedException
- if the output cannot be successfully written.
-
addAsynchronously
public CheckedRunnable<OutputWriteFailedException> addAsynchronously(T element) throws OutputWriteFailedException Likeadd(Object)
but does not immediately execute the underlying add operation, instead returning an operation that can be called later.This is useful for separating the sequential (and therefore not thread-safe, and must be synchronized) from the actual write operation (which must not be synchronized, and is usually more expensive).
This method is thread-safe.
- Parameters:
element
- the element to add.- Returns:
- a runnable, that when called, completes the remain part of the operation.
- Throws:
OutputWriteFailedException
- if the output cannot be successfully written.
-