public static interface ListeningProcessExecutor.ProcessListener
Modifier and Type | Method and Description |
---|---|
void |
onExit(int exitCode)
Called just after the process exits.
|
void |
onStart(ListeningProcessExecutor.LaunchedProcess process)
Called just after the process starts.
|
void |
onStderr(ByteBuffer buffer,
boolean closed)
Called when the process writes bytes to stderr.
|
boolean |
onStdinReady(ByteBuffer buffer)
Called when the process is ready to receive bytes on stdin.
|
void |
onStdout(ByteBuffer buffer,
boolean closed)
Called when the process writes bytes to stdout.
|
void onStart(ListeningProcessExecutor.LaunchedProcess process)
void onExit(int exitCode)
void onStdout(ByteBuffer buffer, boolean closed)
Before this method returns, you must set buffer.position()
to indicate how many
bytes you have consumed.
If you do not consume the entire buffer, any remaining bytes will be passed back to you upon the next invocation (for example, when implementing a UTF-8 decoder which might contain a byte sequence spanning multiple reads).
If closed
is true
, then stdout has been closed and no more bytes will be
received.
void onStderr(ByteBuffer buffer, boolean closed)
Before this method returns, you must set buffer.position()
to indicate how many
bytes you have consumed.
If you do not consume the entire buffer, any remaining bytes will be passed back to you upon the next invocation (for example, when implementing a UTF-8 decoder which might contain a byte sequence spanning multiple reads).
If closed
is true
, then stdout has been closed and no more bytes will be
received.
boolean onStdinReady(ByteBuffer buffer)
Before this method returns, you must set the buffer
's position
and limit
(for example, by invoking Buffer.flip()
) to indicate how much data is in the buffer before returning from this
method.
You must first call ListeningProcessExecutor.LaunchedProcess.wantWrite()
at least once before this method
will be invoked.
If not all of the data needed to be written will fit in buffer
, you can return
true
to indicate that you would like to write more data.
Otherwise, return false
if you have no more data to write to stdin. (You can
always invoke ListeningProcessExecutor.LaunchedProcess.wantWrite()
any time in the future.