Module io.smallrye.common.process
Package io.smallrye.common.process
Interface PipelineBuilder.Output<O>
- Type Parameters:
O- the output type
- All Superinterfaces:
PipelineBuilder<O>
- Enclosing interface:
PipelineBuilder<O>
The output 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 output of the process to the given path.captureHeadLines(int headLines) Set the number of "head" or leading lines of output to capture for exception messages.captureTailLines(int tailLines) Set the number of "tail" or trailing lines of output to capture for exception messages.Set the character set for output character data.default PipelineBuilder.Output<Void> consumeBytesWith(ExceptionConsumer<InputStream, IOException> consumer) Instruct the builder to consume the bytes of the output with the given consumer.default PipelineBuilder.Output<Void> consumeLinesWith(int maxLineLength, ExceptionConsumer<String, IOException> consumer) Instruct the builder to consume each line of the output with the given consumer.default PipelineBuilder.Output<Void> consumeWith(ExceptionConsumer<BufferedReader, IOException> consumer) Instruct the builder to consume the output with the given consumer.default PipelineBuilder.Output<O> copyAndAppendTo(Path path) Instruct the builder to transfer a copy of the output of the process to the given path.Instruct the builder to consume a copy of the bytes of the output with the given consumer.default PipelineBuilder.Output<O> copyAndConsumeLinesWith(int maxLineLength, ExceptionConsumer<String, IOException> consumer) Instruct the builder to consume a copy of each line of the output with the given consumer.Instruct the builder to consume a copy of the output with the given consumer.default PipelineBuilder.Output<O> copyAndTransferTo(OutputStream stream) Instruct the builder to transfer a copy of the output of the process to the given stream.default PipelineBuilder.Output<O> copyAndTransferTo(Writer writer) Instruct the builder to transfer a copy of the output of the process to the given writer.default PipelineBuilder.Output<O> copyAndTransferTo(Path path) Instruct the builder to transfer a copy of the output of the process to the given path.discard()Instruct the builder to discard the output of this process.gatherOnFail(boolean gather) Whenincludeistrueand process execution fails, some or all output lines will be gathered to be included in the thrown exception.Instruct the builder to inherit the process output from the current process.maxCaptureLineLength(int characters) Limit the maximum length of each captured line to the given number of characters.default PipelineBuilder.Output<O> Instruct the builder to use the native output character set for output character data.Push the output of this process into the input of another process, returning a new builder for that process.default PipelineBuilder<Void> Push the output of this process into the input of another process, returning a new builder for that process.default PipelineBuilder<Void> Push the output of this process into the input of another process, returning a new builder for that process.<O2> PipelineBuilder.Output<O2> processBytesWith(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 ofPipelineBuilder.run().<O2> PipelineBuilder.Output<O2> processWith(ExceptionFunction<BufferedReader, O2, IOException> processor) Instruct the builder to process the output with the given function, whose return value is passed to the caller ofPipelineBuilder.run().toSingleString(int maxChars) Instruct the builder to return the output of the process as a single string.toStringList(int maxLines, int maxLineLength) Instruct the builder to return the output of the process as a list of strings.default PipelineBuilder.Output<Void> transferTo(OutputStream stream) Instruct the builder to transfer the output of the process to the given stream.default PipelineBuilder.Output<Void> transferTo(Writer writer) Instruct the builder to transfer the output of the process to the given writer.transferTo(Path path) Instruct the builder to transfer the 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.Output<Void> discard()Instruct the builder to discard the output of this process.- Returns:
- this builder
-
inherited
PipelineBuilder.Output<Void> inherited()Instruct the builder to inherit the process output from the current process.- Returns:
- this builder
-
charset
Set the character set for output character data.- Parameters:
charset- the character set (must not benull)- Returns:
- this builder
-
nativeCharset
Instruct the builder to use the native output character set for output character data.- Returns:
- this builder
-
toSingleString
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
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 listmaxLineLength- the maximum number of characters allowed per line- Returns:
- this builder
-
gatherOnFail
Whenincludeistrueand process execution fails, some or all output lines will be gathered to be included in the thrown exception. The default isfalse.- Parameters:
gather-trueto include output 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 output 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 output to capture for exception messages.- Parameters:
tailLines- the number of tail lines- Returns:
- this builder
-
transferTo
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 benull)- Returns:
- this builder
-
copyAndTransferTo
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 benull)- Returns:
- this builder
-
transferTo
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 benull)- Returns:
- this builder
-
copyAndTransferTo
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 benull)- Returns:
- this builder
-
transferTo
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 benull)- Returns:
- this builder
-
copyAndTransferTo
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 benull)- Returns:
- this builder
-
appendTo
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 benull)- Returns:
- this builder
-
copyAndAppendTo
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 benull)- Returns:
- this builder
-
consumeBytesWith
default PipelineBuilder.Output<Void> consumeBytesWith(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 benull)- Returns:
- this builder
-
copyAndConsumeBytesWith
PipelineBuilder.Output<O> copyAndConsumeBytesWith(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 benull)- Returns:
- this builder
-
consumeWith
default PipelineBuilder.Output<Void> consumeWith(ExceptionConsumer<BufferedReader, IOException> consumer) Instruct the builder to consume the output with the given consumer.- Parameters:
consumer- the consumer (must not benull)- Returns:
- this builder
-
copyAndConsumeWith
PipelineBuilder.Output<O> copyAndConsumeWith(ExceptionConsumer<BufferedReader, IOException> consumer) Instruct the builder to consume a copy of the output with the given consumer.- Parameters:
consumer- the consumer (must not benull)- Returns:
- this builder
-
consumeLinesWith
default PipelineBuilder.Output<Void> consumeLinesWith(int maxLineLength, 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 lineconsumer- the consumer (must not benull)- Returns:
- this builder
-
copyAndConsumeLinesWith
default PipelineBuilder.Output<O> copyAndConsumeLinesWith(int maxLineLength, 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 lineconsumer- the consumer (must not benull)- Returns:
- this builder
-
processBytesWith
<O2> PipelineBuilder.Output<O2> processBytesWith(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 ofPipelineBuilder.run(). The character set is not used for this output mode.- Type Parameters:
O2- the new output type- Parameters:
processor- the processor (must not benull)- Returns:
- this builder
-
processWith
<O2> PipelineBuilder.Output<O2> processWith(ExceptionFunction<BufferedReader, O2, IOException> processor) Instruct the builder to process the output with the given function, whose return value is passed to the caller ofPipelineBuilder.run().- Type Parameters:
O2- the new output type- Parameters:
processor- the processor (must not benull)- Returns:
- this builder
-
pipeTo
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 benull)- Returns:
- the new process builder for the next stage (not
null)
-
pipeTo
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 benull)args- the next stage arguments (must not benull)- Returns:
- the new process builder for the next stage (not
null)
-
pipeTo
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 benull)args- the next stage arguments (must not benull)- Returns:
- the new process builder for the next stage (not
null)
-