Class AbstractOutputPrinter

  • Direct Known Subclasses:
    DefaultOutputPrinter

    public abstract class AbstractOutputPrinter
    extends Object
    Ancestor for printer objects for processes.
    Version:
    $Revision$
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    OutputProcessStream
    • Field Detail

      • m_StdOut

        protected boolean m_StdOut
        whether to output to stdout.
      • m_ID

        protected String m_ID
        the ID of the process.
    • Constructor Detail

      • AbstractOutputPrinter

        public AbstractOutputPrinter​(boolean stdout,
                                     Process process)
        Initializes the printer.
        Parameters:
        stdout - whether to use stdout or stderr
        process - the process to monitor
    • Method Detail

      • initialize

        protected void initialize​(boolean stdout,
                                  Process process)
        Initializes the printer.
        Parameters:
        stdout - whether to use stdout or stderr
        process - the process to monitor
      • getID

        public String getID()
        Returns the ID in use.
        Returns:
        the ID
      • isStdOut

        public boolean isStdOut()
        Returns whether stdout or stderr is used.
        Returns:
        true if stdout is used
      • read

        protected String read()
        Reads a line from the reader and returns it.
        Returns:
        the line read, or null in case of error
      • output

        protected abstract void output​(String line)
        Outputs the specified line.
        Parameters:
        line - the text to output
      • process

        public boolean process()
        Reads and outputs (if possible) a line from the reader.
      • toString

        public String toString()
        Returns a short description.
        Overrides:
        toString in class Object
        Returns:
        the description