Package adams.core.management
Class AbstractOutputPrinter
- java.lang.Object
-
- adams.core.management.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 Summary
Fields Modifier and Type Field Description protected String
m_ID
the ID of the process.protected BufferedReader
m_Reader
the reader.protected boolean
m_StdOut
whether to output to stdout.
-
Constructor Summary
Constructors Constructor Description AbstractOutputPrinter(boolean stdout, Process process)
Initializes the printer.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description String
getID()
Returns the ID in use.protected void
initialize(boolean stdout, Process process)
Initializes the printer.boolean
isStdOut()
Returns whether stdout or stderr is used.protected abstract void
output(String line)
Outputs the specified line.boolean
process()
Reads and outputs (if possible) a line from the reader.protected String
read()
Reads a line from the reader and returns it.String
toString()
Returns a short description.
-
-
-
Field Detail
-
m_StdOut
protected boolean m_StdOut
whether to output to stdout.
-
m_ID
protected String m_ID
the ID of the process.
-
m_Reader
protected BufferedReader m_Reader
the reader.
-
-
Constructor Detail
-
AbstractOutputPrinter
public AbstractOutputPrinter(boolean stdout, Process process)
Initializes the printer.- Parameters:
stdout
- whether to use stdout or stderrprocess
- the process to monitor
-
-
Method Detail
-
initialize
protected void initialize(boolean stdout, Process process)
Initializes the printer.- Parameters:
stdout
- whether to use stdout or stderrprocess
- 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.
-
-