Interface CommandProcess
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DefaultCommandProcess
Process interface.
A process will define some methods to:
A process will define some methods to:
- Read output until a condition returns
false. - Send input stream to the opened process.
- Check if process is closed or still opened.
-
Method Summary
Modifier and TypeMethodDescriptionvoidflush()Flush pending write operations.booleanisClosed()Check if current process has been closed.booleanCheck if current process is still opened.read()Read output until a null line is read.read(OutputHandler handler) Read output until: A null line is read. Handler returns false when line is read. Since command process will not be closed, a simple string is returned (an exit status cannot be computed).voidWrite set of inputs to the current process.voidWrite input string to the current process.Methods inherited from interface java.lang.AutoCloseable
close
-
Method Details
-
read
Read output until a null line is read.
Since command process will not be closed, a simple string is returned (an exit status cannot be computed).- Returns:
- Command result.
- Throws:
IOException- If an error occurred during operation.
-
read
Read output until:- A null line is read.
- Handler returns false when line is read.
- Parameters:
handler- Output handler.- Returns:
- Full output.
- Throws:
IOException- If an error occurred during operation.
-
write
Write input string to the current process.- Parameters:
input- Input.others- Other inputs.- Throws:
IOException- If an error occurred during operation.
-
write
Write set of inputs to the current process.- Parameters:
inputs- Collection of inputs.- Throws:
IOException- If an error occurred during operation.
-
flush
Flush pending write operations.- Throws:
IOException- If an error occurred during operation.
-
isRunning
boolean isRunning()Check if current process is still opened. If this method returnstrue, thenisClosed()should returnfalse.- Returns:
trueif process is open,falseotherwise.
-
isClosed
boolean isClosed()Check if current process has been closed. If this method returnstrue, thenisRunning()should returnfalse.- Returns:
trueif process is closed,falseotherwise.
-