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 TypeMethodDescriptionvoid
flush()
Flush pending write operations.boolean
isClosed()
Check if current process has been closed.boolean
Check 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).void
Write set of inputs to the current process.void
Write 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:
true
if process is open,false
otherwise.
-
isClosed
boolean isClosed()Check if current process has been closed. If this method returnstrue
, thenisRunning()
should returnfalse
.- Returns:
true
if process is closed,false
otherwise.
-