Module io.smallrye.common.process
Package io.smallrye.common.process
Interface PipelineBuilder.Error<O>
- Type Parameters:
O- the output type
- All Superinterfaces:
PipelineBuilder<O>
- Enclosing interface:
PipelineBuilder<O>
The error handling aspect of the process builder.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.smallrye.common.process.PipelineBuilder
PipelineBuilder.Error<O>, PipelineBuilder.Output<O> -
Method Summary
Modifier and TypeMethodDescriptionInstruct the builder to transfer the error output of the process to the given path.captureHeadLines(int headLines) Set the number of "head" or leading lines of error to capture for exception messages.captureTailLines(int tailLines) Set the number of "tail" or trailing lines of error to capture for exception messages.Set the character set to use for error output.consumeBytesWith(io.smallrye.common.function.ExceptionConsumer<InputStream, IOException> consumer) Instruct the builder to consume the bytes of the error output with the given consumer.default PipelineBuilder.Error<O> consumeLinesWith(int maxLineLength, io.smallrye.common.function.ExceptionConsumer<String, IOException> consumer) Instruct the builder to consume each line of the error output with the given consumer.consumeWith(io.smallrye.common.function.ExceptionConsumer<BufferedReader, IOException> consumer) Instruct the builder to consume the error output with the given consumer.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.copyAndConsumeBytesWith(io.smallrye.common.function.ExceptionConsumer<InputStream, IOException> consumer) Instruct the builder to consume a copy of the bytes of the error output with the given consumer.default PipelineBuilder.Error<O> copyAndConsumeLinesWith(int maxLineLength, io.smallrye.common.function.ExceptionConsumer<String, IOException> consumer) Instruct the builder to consume each line of a copy of the error output with the given consumer.copyAndConsumeWith(io.smallrye.common.function.ExceptionConsumer<BufferedReader, IOException> consumer) Instruct the builder to consume a copy of the error output with the given consumer.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.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.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.discard()Instruct the builder to discard the error output.gatherOnFail(boolean gather) Whenincludeistrueand process execution fails, some or all error lines will be gathered to be included in the thrown exception.Instruct the builder to copy the error output of the process being built to the error output of the current process.logOnSuccess(boolean log) Whenlogistrueand process execution completes successfully, any non-empty error lines will be logged at levelWARN.maxCaptureLineLength(int characters) Limit the maximum length of each captured line to the given number of characters.default PipelineBuilder.Error<O> Instruct the builder to use the native character set for error outputredirect()Redirect error output to the output stream, overriding all other output considerations.default PipelineBuilder.Error<O> transferTo(OutputStream stream) Instruct the builder to transfer the error output of the process to the given stream.default PipelineBuilder.Error<O> transferTo(Writer writer) Instruct the builder to transfer the error output of the process to the given writer.transferTo(Path path) Instruct the builder to transfer the error output of the process to the given path.Methods inherited from interface io.smallrye.common.process.PipelineBuilder
arguments, arguments, directory, environment, error, exitCodeChecker, modifyEnvironment, output, run, runAsync, specialQuoting, whileRunning
-
Method Details
-
discard
PipelineBuilder.Error<O> 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
Set the character set to use for error output.- Parameters:
charset- the character set (must not benull)- Returns:
- this builder
-
nativeCharset
Instruct the builder to use the native character set for error output- Returns:
- this builder
-
logOnSuccess
Whenlogistrueand process execution completes successfully, any non-empty error lines will be logged at levelWARN.- Parameters:
log-trueto log error lines on success, orfalseto not log them- Returns:
- this builder
-
gatherOnFail
Whenincludeistrueand process execution fails, some or all error lines will be gathered to be included in the thrown exception. The default istrue.- Parameters:
gather-trueto include error lines in the thrown exception, orfalsenot to- Returns:
- this builder
-
maxCaptureLineLength
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
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
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
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 benull)- Returns:
- this builder
-
copyAndTransferTo
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 benull)- Returns:
- this builder
-
transferTo
Instruct the builder to transfer the error output of the process to the given writer.- Parameters:
writer- the writer to transfer to (must not benull)- Returns:
- this builder
-
copyAndTransferTo
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 benull)- Returns:
- this builder
-
transferTo
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 benull)- Returns:
- this builder
-
copyAndTransferTo
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 benull)- Returns:
- this builder
-
appendTo
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 benull)- Returns:
- this builder
-
copyAndAppendTo
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 benull)- Returns:
- this builder
-
consumeBytesWith
PipelineBuilder.Error<O> consumeBytesWith(io.smallrye.common.function.ExceptionConsumer<InputStream, IOException> consumer) Instruct the builder to consume the bytes of the error output with the given consumer.- Parameters:
consumer- the consumer (must not benull)- Returns:
- this builder
-
copyAndConsumeBytesWith
PipelineBuilder.Error<O> copyAndConsumeBytesWith(io.smallrye.common.function.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 benull)- Returns:
- this builder
-
consumeWith
PipelineBuilder.Error<O> consumeWith(io.smallrye.common.function.ExceptionConsumer<BufferedReader, IOException> consumer) Instruct the builder to consume the error output with the given consumer.- Parameters:
consumer- the consumer (must not benull)- Returns:
- this builder
-
copyAndConsumeWith
PipelineBuilder.Error<O> copyAndConsumeWith(io.smallrye.common.function.ExceptionConsumer<BufferedReader, IOException> consumer) Instruct the builder to consume a copy of the error output with the given consumer.- Parameters:
consumer- the consumer (must not benull)- Returns:
- this builder
-
consumeLinesWith
default PipelineBuilder.Error<O> consumeLinesWith(int maxLineLength, io.smallrye.common.function.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 lineconsumer- the consumer (must not benull)- Returns:
- this builder
-
copyAndConsumeLinesWith
default PipelineBuilder.Error<O> copyAndConsumeLinesWith(int maxLineLength, io.smallrye.common.function.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 lineconsumer- the consumer (must not benull)- Returns:
- this builder
-
redirect
PipelineBuilder.Error<O> redirect()Redirect error output to the output stream, overriding all other output considerations. This implicitly setslogOnSuccess(boolean)andgatherOnFail(boolean)tofalseand ignores allcopyAnd...()handlers.- Returns:
- this builder
-