Class AProcessListener

  • All Implemented Interfaces:
    IProcessListener
    Direct Known Subclasses:
    DefaultProcessListener

    public abstract class AProcessListener
    extends java.lang.Object
    implements IProcessListener
    The process listener may be attached to a process in order to handle its ouputs streams in a controlled way. For instance, the process listener can be used to pipe all outputs of the invoked process to a logger system.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      abstract void handleError​(java.lang.String error)
      Handle the output of the error output stream.
      abstract void handleInput​(java.lang.String input)
      Handle the output of the standard output stream.
      void listenTo​(java.lang.Process process)
      Lets the process listener listen to the output and error stream of the given process.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AProcessListener

        public AProcessListener()
    • Method Detail

      • listenTo

        public void listenTo​(java.lang.Process process)
                      throws java.io.IOException,
                             java.lang.InterruptedException
        Description copied from interface: IProcessListener
        Lets the process listener listen to the output and error stream of the given process.
        Specified by:
        listenTo in interface IProcessListener
        Parameters:
        process - The process to be listened to.
        Throws:
        java.io.IOException
        java.lang.InterruptedException
      • handleError

        public abstract void handleError​(java.lang.String error)
                                  throws java.io.IOException,
                                         java.lang.InterruptedException
        Handle the output of the error output stream.
        Parameters:
        error - The line sent by the process via the error stream.
        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 error messages.
      • handleInput

        public abstract void handleInput​(java.lang.String input)
                                  throws java.io.IOException,
                                         java.lang.InterruptedException
        Handle the output of the standard output stream.
        Parameters:
        error - The line sent by the process via the standard output stream.
        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.