Class WriterPipe

  • All Implemented Interfaces:
    Closeable, AutoCloseable, BasePipe

    public class WriterPipe
    extends TerminalPipe
    A terminal pipe writing textual items to a given Writer, one item per line. Calling start() blocks until all data from the input pipe is written to the writer.
    Author:
    Eyal Schneider
    • Constructor Detail

      • WriterPipe

        public WriterPipe​(Pipe<String> input,
                          Writer w)
        Constructor
        Parameters:
        input - The input pipe to read items from
        w - The writer to write to
      • WriterPipe

        public WriterPipe​(Pipe<String> input,
                          Writer w,
                          int bufferSize)
        Constructor
        Parameters:
        input - The input pipe to read items from
        w - The writer to write to
        bufferSize - the write buffer to use
    • Method Detail

      • start

        public void start()
                   throws PipeException,
                          InterruptedException
        Description copied from interface: BasePipe
        Performs 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.