Class ProcessReader
java.lang.Object
org.owasp.dependencycheck.utils.processing.ProcessReader
- All Implemented Interfaces:
AutoCloseable
Utility to read the output from a `Process` and places the output into
provide storage containers.
- Author:
- Jeremy Long
-
Constructor Summary
ConstructorsConstructorDescriptionProcessReader(Process process) Creates a new reader for the given process.ProcessReader(Process process, Processor<InputStream> processor) Creates a new reader for the given process. -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Waits for the process and related threads to complete.getError()Returns the error stream output from the process.Returns the output from standard out from the process.voidreadAll()Reads the standard output and standard error from the process and waits for the process to complete.
-
Constructor Details
-
ProcessReader
Creates a new reader for the given process. The output from the process is written to the provided stores.- Parameters:
process- the process to read from
-
ProcessReader
Creates a new reader for the given process. The output from the process is written to the provided stores.- Parameters:
process- the process to read fromprocessor- used to process the input stream from the process
-
-
Method Details
-
getError
Returns the error stream output from the process.- Returns:
- the error stream output
-
getOutput
Returns the output from standard out from the process.- Returns:
- the output from standard out from the process
-
readAll
Reads the standard output and standard error from the process and waits for the process to complete.- Throws:
InterruptedException- thrown if the processing threads are interruptedIOException- thrown if there is an error reading from the process
-
close
Waits for the process and related threads to complete.- Specified by:
closein interfaceAutoCloseable- Throws:
InterruptedException- thrown if the processing threads are interruptedIOException- thrown if there was an error reading from the process
-