Package org.pipecraft.pipes.terminal
Class AsyncCollectionWriterPipe<T>
- java.lang.Object
-
- org.pipecraft.pipes.terminal.TerminalPipe
-
- org.pipecraft.pipes.terminal.AsyncCollectionWriterPipe<T>
-
- All Implemented Interfaces:
Closeable,AutoCloseable,BasePipe
public class AsyncCollectionWriterPipe<T> extends TerminalPipe
A terminal async pipe writing all contents from an input pipe into a given collection. Thread safety: It's the responsibility of the caller to use a thread safe collection!- Author:
- Eyal Schneider
-
-
Constructor Summary
Constructors Constructor Description AsyncCollectionWriterPipe(AsyncPipe<T> input)Constructor Collects items into a thread safeListcreated internally.AsyncCollectionWriterPipe(AsyncPipe<T> input, Collection<T> outputCollection)Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Collection<T>getItems()voidstart()Performs pre-processing prior to item flow throw the pipe.-
Methods inherited from class org.pipecraft.pipes.terminal.TerminalPipe
getProgress
-
-
-
-
Constructor Detail
-
AsyncCollectionWriterPipe
public AsyncCollectionWriterPipe(AsyncPipe<T> input, Collection<T> outputCollection)
Constructor- Parameters:
input- The input pipeoutputCollection- The output collection to write items to. Must be thread safe!
-
-
Method Detail
-
close
public void close() throws IOException- Throws:
IOException
-
start
public void start() throws PipeException, InterruptedExceptionDescription copied from interface:BasePipePerforms pre-processing prior to item flow throw the pipe. Implementations must call the same method for all their input pipes before accessing their items. This is typically done here.- Throws:
PipeException- In case of pipe errors in this pipe or somewhere up-stream.InterruptedException- In case that the operation has been interrupted by another thread.
-
getItems
public Collection<T> getItems()
- Returns:
- The collection given in the constructor
-
-