Package adams.core.command.output
Class AbstractOutputFormatter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.core.command.output.AbstractOutputFormatter
-
- All Implemented Interfaces:
CleanUpHandler
,OutputFormatter
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,Serializable
- Direct Known Subclasses:
LineSplit
,PassThrough
public abstract class AbstractOutputFormatter extends AbstractOptionHandler implements OutputFormatter
Ancestor for output formatters.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractOutputFormatter()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
canFormatOutput(ExternalCommand command, boolean stdout)
Determines whether the output should be formatted and forwarded to the command.void
cleanUp()
Cleans up data structures, frees up memory.protected abstract void
doFormatOutput(ExternalCommand command, boolean stdout, boolean blocking, String output)
Formats the output received from the command.void
formatOutput(ExternalCommand command, boolean stdout, boolean blocking, String output)
Formats the output received from the command.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.command.output.OutputFormatter
generates
-
-
-
-
Method Detail
-
canFormatOutput
protected boolean canFormatOutput(ExternalCommand command, boolean stdout)
Determines whether the output should be formatted and forwarded to the command.- Parameters:
command
- the command to forward the output tostdout
- whether the output occurred on stdout- Returns:
- true if to forward the output to the command
-
doFormatOutput
protected abstract void doFormatOutput(ExternalCommand command, boolean stdout, boolean blocking, String output)
Formats the output received from the command. Feeds the formatted data back into the ExternalCommand instance.- Parameters:
command
- the external command to feed the output back intostdout
- whether the output was from stdout or stderrblocking
- whether the output was received via blocking or async executionoutput
- the output to format
-
formatOutput
public void formatOutput(ExternalCommand command, boolean stdout, boolean blocking, String output)
Formats the output received from the command. Feeds the formatted data back into the ExternalCommand instance.- Specified by:
formatOutput
in interfaceOutputFormatter
- Parameters:
command
- the external command to feed the output back intostdout
- whether the output was from stdout or stderrblocking
- whether the output was received via blocking or async executionoutput
- the output to format
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.- Specified by:
cleanUp
in interfaceCleanUpHandler
-
-