Package ai.libs.python
Class DefaultProcessListener
- java.lang.Object
-
- ai.libs.python.AProcessListener
-
- ai.libs.python.DefaultProcessListener
-
- All Implemented Interfaces:
IProcessListener,org.api4.java.common.control.ILoggingCustomizable
public class DefaultProcessListener extends AProcessListener implements org.api4.java.common.control.ILoggingCustomizable
The DefaultProcessListener might be used to forward any type of outputs of a process to a logger.
-
-
Constructor Summary
Constructors Constructor Description DefaultProcessListener()Constructor to initialize the DefaultProcessListener.DefaultProcessListener(boolean listenToPIDFromProcess)Constructor to initialize the DefaultProcessListener.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetDefaultOutput()java.lang.StringgetErrorOutput()java.lang.StringgetLoggerName()voidhandleError(java.lang.String error)Handle the output of the error output stream.voidhandleInput(java.lang.String input)Handle the output of the standard output stream.voidsetLoggerName(java.lang.String name)-
Methods inherited from class ai.libs.python.AProcessListener
listenTo
-
-
-
-
Constructor Detail
-
DefaultProcessListener
public DefaultProcessListener()
Constructor to initialize the DefaultProcessListener.- Parameters:
verbose- Flag whether standard outputs are forwarded to the logger.
-
DefaultProcessListener
public DefaultProcessListener(boolean listenToPIDFromProcess)
Constructor to initialize the DefaultProcessListener.- Parameters:
verbose- Flag whether standard outputs are forwarded to the logger.
-
-
Method Detail
-
handleError
public void handleError(java.lang.String error)
Description copied from class:AProcessListenerHandle the output of the error output stream.- Specified by:
handleErrorin classAProcessListener- Parameters:
error- The line sent by the process via the error stream.
-
handleInput
public void handleInput(java.lang.String input) throws java.io.IOException, java.lang.InterruptedExceptionDescription copied from class:AProcessListenerHandle the output of the standard output stream.- Specified by:
handleInputin classAProcessListener- Throws:
java.io.IOException- An IOException is thrown if there is an issue reading from the process's stream.java.lang.InterruptedException- An interrupted exception is thrown if the thread/process is interrupted while processing the standard output messages.
-
getErrorOutput
public java.lang.String getErrorOutput()
-
getDefaultOutput
public java.lang.String getDefaultOutput()
-
getLoggerName
public java.lang.String getLoggerName()
- Specified by:
getLoggerNamein interfaceorg.api4.java.common.control.ILoggingCustomizable- Overrides:
getLoggerNamein classAProcessListener
-
setLoggerName
public void setLoggerName(java.lang.String name)
- Specified by:
setLoggerNamein interfaceorg.api4.java.common.control.ILoggingCustomizable- Overrides:
setLoggerNamein classAProcessListener
-
-