Class OutputSequenceIncrementing<T>

Object
OutputSequenceIncrementing<T>
Type Parameters:
T - element-type in generator

public class OutputSequenceIncrementing<T> extends Object
A sequence of outputs that use the same generator, where each output increments an index by one in the filename.
Author:
Owen Feehan
  • Constructor Details

  • Method Details

    • add

      public void add(T element) throws OutputWriteFailedException
      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
      Like add(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.