Interface PipelineBuilder.Error<O>

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

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

    • discard

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

      PipelineBuilder.Error<O> inherited()
      Instruct the builder to copy the error output of the process being built to the error output of the current process.
      Returns:
      this builder
    • charset

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

      default PipelineBuilder.Error<O> nativeCharset()
      Instruct the builder to use the native character set for error output
      Returns:
      this builder
    • logOnSuccess

      PipelineBuilder.Error<O> logOnSuccess(boolean log)
      When log is true and process execution completes successfully, any non-empty error lines will be logged at level WARN.
      Parameters:
      log - true to log error lines on success, or false to not log them
      Returns:
      this builder
    • gatherOnFail

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

      PipelineBuilder.Error<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.Error<O> captureHeadLines(int headLines)
      Set the number of "head" or leading lines of error to capture for exception messages.
      Parameters:
      headLines - the number of head lines
      Returns:
      this builder
    • captureTailLines

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

      default PipelineBuilder.Error<O> transferTo(OutputStream stream)
      Instruct the builder to transfer the error output of the process to the given stream.
      Parameters:
      stream - the output stream to transfer to (must not be null)
      Returns:
      this builder
    • copyAndTransferTo

      default PipelineBuilder.Error<O> copyAndTransferTo(OutputStream stream)
      Instruct the builder to transfer a copy of the error output of the process to the given stream.
      Parameters:
      stream - the output stream to transfer to (must not be null)
      Returns:
      this builder
    • transferTo

      default PipelineBuilder.Error<O> transferTo(Writer writer)
      Instruct the builder to transfer the error output of the process to the given writer.
      Parameters:
      writer - the writer to transfer to (must not be null)
      Returns:
      this builder
    • copyAndTransferTo

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

      PipelineBuilder.Error<O> transferTo(Path path)
      Instruct the builder to transfer the error output of the process to the given path. The file at the given path will be truncated if it exists.
      Parameters:
      path - the path to transfer to (must not be null)
      Returns:
      this builder
    • copyAndTransferTo

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

      PipelineBuilder.Error<O> appendTo(Path path)
      Instruct the builder to transfer the error output of the process to the given path. The file at the given path will be appended to if it exists.
      Parameters:
      path - the path to transfer to (must not be null)
      Returns:
      this builder
    • copyAndAppendTo

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

      Instruct the builder to consume the bytes of the error output with the given consumer.
      Parameters:
      consumer - the consumer (must not be null)
      Returns:
      this builder
    • copyAndConsumeBytesWith

      PipelineBuilder.Error<O> copyAndConsumeBytesWith(ExceptionConsumer<InputStream,IOException> consumer)
      Instruct the builder to consume a copy of the bytes of the error output with the given consumer.
      Parameters:
      consumer - the consumer (must not be null)
      Returns:
      this builder
    • consumeWith

      Instruct the builder to consume the error output with the given consumer.
      Parameters:
      consumer - the consumer (must not be null)
      Returns:
      this builder
    • copyAndConsumeWith

      Instruct the builder to consume a copy of the error output with the given consumer.
      Parameters:
      consumer - the consumer (must not be null)
      Returns:
      this builder
    • consumeLinesWith

      default PipelineBuilder.Error<O> consumeLinesWith(int maxLineLength, ExceptionConsumer<String,IOException> consumer)
      Instruct the builder to consume each line of the error 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.Error<O> copyAndConsumeLinesWith(int maxLineLength, ExceptionConsumer<String,IOException> consumer)
      Instruct the builder to consume each line of a copy of the error 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
    • redirect

      Redirect error output to the output stream, overriding all other output considerations. This implicitly sets logOnSuccess(boolean) and gatherOnFail(boolean) to false and ignores all copyAnd...() handlers.
      Returns:
      this builder