Class IOResult
java.lang.Object
generic.concurrent.io.IOResult
- All Implemented Interfaces:
Runnable
Runnable that will consume all text output from an InputStream tied to an
external processes (stdout / stderr).
The output can be inspected line-by-line by providing a string Consumer, or the entire
output of the process can be inspected by calling getOutput() or
getOutputAsString().
-
Field Summary
Fields -
Constructor Summary
ConstructorsChangeConstructorDescriptionIOResult(InputStream input) Creates aIOResultthat consumes the specifiedInputStream, saving it as text lines.IOResult(InputStream input, Throwable inception) Creates aIOResultthat consumes the specifiedInputStream, saving it as text lines.IOResult(InputStream input, Consumer<String> lineConsumer, boolean retainLines, Throwable inception) Creates aIOResultthat consumes the specifiedInputStream, handing each line to theConsumerand optionally storing each line for later retrieval.IOResult(InputStream input, Consumer<String> lineConsumer, Throwable inception) -
Method Summary
-
Field Details
-
THREAD_POOL_NAME
- See Also:
-
-
Constructor Details
-
IOResult
Creates aIOResultthat consumes the specifiedInputStream, saving it as text lines.- Parameters:
input-InputStream
-
IOResult
Creates aIOResultthat consumes the specifiedInputStream, saving it as text lines.- Parameters:
input-InputStreaminception- information about where this object was created
-
IOResult
Creates aIOResultthat consumes the specifiedInputStream, handing each line to theConsumer.Example:
new IOResult(process.getInputStream(), s -> System.out.println(s), null);- Parameters:
input-InputStreamlineConsumer-string consumerinception- information about where this object was created
-
IOResult
public IOResult(InputStream input, Consumer<String> lineConsumer, boolean retainLines, Throwable inception) Creates aIOResultthat consumes the specifiedInputStream, handing each line to theConsumerand optionally storing each line for later retrieval.- Parameters:
input-InputStreamlineConsumer-string consumer, optionalretainLines- boolean flag, if true, the contents read from the InputStream will be available viagetOutput()andgetOutputAsString()inception- information about where this object was created
-
-
Method Details
-
getOutputAsString
-
getOutput
-
run
-