public class ByteStreamSequentializer extends Object
OutputStream | Constructor and Description | 
|---|
| ByteStreamSequentializer(OutputStream delegate,
                        ExecutorService squadExecutor) | 
| Modifier and Type | Method and Description | 
|---|---|
| void | awaitCompletion()Returns when all tasks that were previously submitted with  submit(Consumer)andsubmit(ConsumerWhichThrows)have completed. | 
| void | submit(Consumer<? super OutputStream> task)Data written to the task's subject will be written to the  delegateafter all data written by the
 previously submitted tasks, and before the data written by all tasks submitted afterwards. | 
| <EX extends Throwable> | submit(ConsumerWhichThrows<? super OutputStream,EX> task) | 
public ByteStreamSequentializer(OutputStream delegate, ExecutorService squadExecutor)
ByteStreamSequentializerpublic void submit(Consumer<? super OutputStream> task)
delegate after all data written by the
 previously submitted tasks, and before the data written by all tasks submitted afterwards.
 
   Notice that when a tasks submits another task (subtask), then the output of the subtask will
   appear after the output of the task (and the output of all other tasks submitted in the meantime).
   If you want to have the output of subtasks to be in the middle of the task's output, then you should
   create a second ByteStreamSequentializer and await its completion.
 
public <EX extends Throwable> void submit(ConsumerWhichThrows<? super OutputStream,EX> task)
submit(Consumer)public void awaitCompletion()
                     throws InterruptedException,
                            ExecutionException,
                            CancellationException,
                            IOException
submit(Consumer) and submit(ConsumerWhichThrows) have completed.CancellationException - One of the tasks was cancelledExecutionException - One of the tasks threw an exceptionInterruptedException - The current thread was interrupted while waitingIOExceptionCopyright © 2018 Arno Unkrig. All rights reserved.