Interface PipelineBuilder.Output<O>

Type Parameters:
O - the output type
All Superinterfaces:
PipelineBuilder<O>
Enclosing interface:
PipelineBuilder<O>

public static sealed interface PipelineBuilder.Output<O> extends PipelineBuilder<O>
The output handling aspect of the process builder.
  • Method Details

    • discard

      Instruct the builder to discard the output of this process.
      Returns:
      this builder
    • inherited

      Instruct the builder to inherit the process output from the current process.
      Returns:
      this builder
    • charset

      PipelineBuilder.Output<O> charset(Charset charset)
      Set the character set for output character data.
      Parameters:
      charset - the character set (must not be null)
      Returns:
      this builder
    • nativeCharset

      default PipelineBuilder.Output<O> nativeCharset()
      Instruct the builder to use the native output character set for output character data.
      Returns:
      this builder
    • toSingleString

      PipelineBuilder.Output<String> toSingleString(int maxChars)
      Instruct the builder to return the output of the process as a single string.
      Parameters:
      maxChars - the maximum number of characters for the returned string
      Returns:
      this builder
    • toStringList

      PipelineBuilder.Output<List<String>> toStringList(int maxLines, int maxLineLength)
      Instruct the builder to return the output of the process as a list of strings.
      Parameters:
      maxLines - the maximum number of lines for the returned list
      maxLineLength - the maximum number of characters allowed per line
      Returns:
      this builder
    • gatherOnFail

      PipelineBuilder.Output<O> gatherOnFail(boolean gather)
      When include is true and process execution fails, some or all output lines will be gathered to be included in the thrown exception. The default is false.
      Parameters:
      gather - true to include output lines in the thrown exception, or false not to
      Returns:
      this builder
    • maxCaptureLineLength

      PipelineBuilder.Output<O> maxCaptureLineLength(int characters)
      Limit the maximum length of each captured line to the given number of characters. The line terminator is not included in the count.
      Parameters:
      characters - the maximum number of characters
      Returns:
      this builder
      Throws:
      IllegalArgumentException - if the number of characters is less than 1
    • captureHeadLines

      PipelineBuilder.Output<O> captureHeadLines(int headLines)
      Set the number of "head" or leading lines of output to capture for exception messages.
      Parameters:
      headLines - the number of head lines
      Returns:
      this builder
    • captureTailLines

      PipelineBuilder.Output<O> captureTailLines(int tailLines)
      Set the number of "tail" or trailing lines of output to capture for exception messages.
      Parameters:
      tailLines - the number of tail lines
      Returns:
      this builder
    • transferTo

      default PipelineBuilder.Output<Void> transferTo(OutputStream stream)
      Instruct the builder to transfer the output of the process to the given stream. The stream is not closed. The character set is not used for this output mode.
      Parameters:
      stream - the output stream to transfer to (must not be null)
      Returns:
      this builder
    • copyAndTransferTo

      default PipelineBuilder.Output<O> copyAndTransferTo(OutputStream stream)
      Instruct the builder to transfer a copy of the output of the process to the given stream. The stream is not closed. The character set is not used for this output mode.
      Parameters:
      stream - the output stream to transfer to (must not be null)
      Returns:
      this builder
    • transferTo

      default PipelineBuilder.Output<Void> transferTo(Writer writer)
      Instruct the builder to transfer the output of the process to the given writer. The writer is not closed.
      Parameters:
      writer - the writer to transfer to (must not be null)
      Returns:
      this builder
    • copyAndTransferTo

      default PipelineBuilder.Output<O> copyAndTransferTo(Writer writer)
      Instruct the builder to transfer a copy of the output of the process to the given writer. The writer is not closed.
      Parameters:
      writer - the writer to transfer to (must not be null)
      Returns:
      this builder
    • transferTo

      PipelineBuilder.Output<Void> transferTo(Path path)
      Instruct the builder to transfer the output of the process to the given path. The file at the given path will be truncated if it exists. The character set is not used for this output mode.
      Parameters:
      path - the path to transfer to (must not be null)
      Returns:
      this builder
    • copyAndTransferTo

      default PipelineBuilder.Output<O> copyAndTransferTo(Path path)
      Instruct the builder to transfer a copy of the output of the process to the given path. The file at the given path will be truncated if it exists. The character set is not used for this output mode.
      Parameters:
      path - the path to transfer to (must not be null)
      Returns:
      this builder
    • appendTo

      PipelineBuilder.Output<Void> appendTo(Path path)
      Instruct the builder to transfer the output of the process to the given path. The file at the given path will be appended to if it exists. The character set is not used for this output mode.
      Parameters:
      path - the path to transfer to (must not be null)
      Returns:
      this builder
    • copyAndAppendTo

      default PipelineBuilder.Output<O> copyAndAppendTo(Path path)
      Instruct the builder to transfer a copy of the output of the process to the given path. The file at the given path will be appended to if it exists. The character set is not used for this output mode.
      Parameters:
      path - the path to transfer to (must not be null)
      Returns:
      this builder
    • consumeBytesWith

      default PipelineBuilder.Output<Void> consumeBytesWith(io.smallrye.common.function.ExceptionConsumer<InputStream,IOException> consumer)
      Instruct the builder to consume the bytes of the output with the given consumer. The character set is not used for this output mode.
      Parameters:
      consumer - the consumer (must not be null)
      Returns:
      this builder
    • copyAndConsumeBytesWith

      PipelineBuilder.Output<O> copyAndConsumeBytesWith(io.smallrye.common.function.ExceptionConsumer<InputStream,IOException> consumer)
      Instruct the builder to consume a copy of the bytes of the output with the given consumer. The character set is not used for this output mode.
      Parameters:
      consumer - the consumer (must not be null)
      Returns:
      this builder
    • consumeWith

      default PipelineBuilder.Output<Void> consumeWith(io.smallrye.common.function.ExceptionConsumer<BufferedReader,IOException> consumer)
      Instruct the builder to consume the output with the given consumer.
      Parameters:
      consumer - the consumer (must not be null)
      Returns:
      this builder
    • copyAndConsumeWith

      PipelineBuilder.Output<O> copyAndConsumeWith(io.smallrye.common.function.ExceptionConsumer<BufferedReader,IOException> consumer)
      Instruct the builder to consume a copy of the output with the given consumer.
      Parameters:
      consumer - the consumer (must not be null)
      Returns:
      this builder
    • consumeLinesWith

      default PipelineBuilder.Output<Void> consumeLinesWith(int maxLineLength, io.smallrye.common.function.ExceptionConsumer<String,IOException> consumer)
      Instruct the builder to consume each line of the output with the given consumer.
      Parameters:
      maxLineLength - the maximum number of characters allowed per line
      consumer - the consumer (must not be null)
      Returns:
      this builder
    • copyAndConsumeLinesWith

      default PipelineBuilder.Output<O> copyAndConsumeLinesWith(int maxLineLength, io.smallrye.common.function.ExceptionConsumer<String,IOException> consumer)
      Instruct the builder to consume a copy of each line of the output with the given consumer.
      Parameters:
      maxLineLength - the maximum number of characters allowed per line
      consumer - the consumer (must not be null)
      Returns:
      this builder
    • processBytesWith

      <O2> PipelineBuilder.Output<O2> processBytesWith(io.smallrye.common.function.ExceptionFunction<InputStream,O2,IOException> processor)
      Instruct the builder to process the bytes of the output with the given function, whose return value is passed to the caller of PipelineBuilder.run(). The character set is not used for this output mode.
      Type Parameters:
      O2 - the new output type
      Parameters:
      processor - the processor (must not be null)
      Returns:
      this builder
    • processWith

      <O2> PipelineBuilder.Output<O2> processWith(io.smallrye.common.function.ExceptionFunction<BufferedReader,O2,IOException> processor)
      Instruct the builder to process the output with the given function, whose return value is passed to the caller of PipelineBuilder.run().
      Type Parameters:
      O2 - the new output type
      Parameters:
      processor - the processor (must not be null)
      Returns:
      this builder
    • pipeTo

      PipelineBuilder<Void> pipeTo(Path command)
      Push the output of this process into the input of another process, returning a new builder for that process. The returned process builder cannot have its input configured, because its input will always come from the output of the process built by this builder. Running the final process in the pipeline will start the entire pipeline. After calling this method, this process builder may no longer be modified or executed; therefore, it must be the last method called when building a pipeline. The character set is not used for this output mode.
      Parameters:
      command - the next stage command (must not be null)
      Returns:
      the new process builder for the next stage (not null)
    • pipeTo

      default PipelineBuilder<Void> pipeTo(Path command, List<String> args)
      Push the output of this process into the input of another process, returning a new builder for that process. The returned process builder may not have its input configured, because its input will always come from the output of the process built by this builder. Running the final process in the pipeline will start the entire pipeline. After calling this method, this process builder may no longer be modified or executed; therefore, it must be the last method called when building a pipeline. The character set is not used for this output mode.
      Parameters:
      command - the next stage command (must not be null)
      args - the next stage arguments (must not be null)
      Returns:
      the new process builder for the next stage (not null)
    • pipeTo

      default PipelineBuilder<Void> pipeTo(Path command, String... args)
      Push the output of this process into the input of another process, returning a new builder for that process. The returned process builder may not have its input configured, because its input will always come from the output of the process built by this builder. Running the final process in the pipeline will start the entire pipeline. After calling this method, this process builder may no longer be modified or executed; therefore, it must be the last method called when building a pipeline. The character set is not used for this output mode.
      Parameters:
      command - the next stage command (must not be null)
      args - the next stage arguments (must not be null)
      Returns:
      the new process builder for the next stage (not null)