Class 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 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: AProcessListener
        Handle the output of the error output stream.
        Specified by:
        handleError in class AProcessListener
        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.InterruptedException
        Description copied from class: AProcessListener
        Handle the output of the standard output stream.
        Specified by:
        handleInput in class AProcessListener
        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:
        getLoggerName in interface org.api4.java.common.control.ILoggingCustomizable
        Overrides:
        getLoggerName in class AProcessListener
      • setLoggerName

        public void setLoggerName​(java.lang.String name)
        Specified by:
        setLoggerName in interface org.api4.java.common.control.ILoggingCustomizable
        Overrides:
        setLoggerName in class AProcessListener