Package adams.data.io.output
Class DefaultFlowWriter
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,EncodingSupporter,FileFormatHandler,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,FlowWriter,NestedFlowWriter,Serializable
public class DefaultFlowWriter extends AbstractNestedFlowWriter implements EncodingSupporter
Writes flows in the default format (nested).- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class adams.data.io.output.AbstractFlowWriter
AbstractFlowWriter.OutputType
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseCharsetm_Encodingthe encoding to use.protected booleanm_UseCompactwhether to use compact format.-
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 DefaultFlowWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.protected booleandoWrite(Actor content, File file)Writes the given content to the specified file.protected booleandoWrite(Actor content, OutputStream out)Performs the actual writing.protected booleandoWrite(Actor content, Writer writer)Performs the actual writing.protected booleandoWrite(List content, File file)Writes the given content to the specified file.protected booleandoWrite(List content, OutputStream out)Performs the actual writing.protected booleandoWrite(List content, Writer writer)Performs the actual writing.StringencodingTipText()Returns the tip text for this property.FlowReadergetCorrespondingReader()Returns the corresponding reader, if available.protected booleangetDefaultUseCompact()Returns the default missing value.BaseCharsetgetEncoding()Returns the encoding to use.StringgetFormatDescription()Returns a string describing the format (used in the file chooser).String[]getFormatExtensions()Returns the extension(s) of the format.protected AbstractFlowWriter.OutputTypegetOutputType()Returns how to write the data, from a file, stream or writer.booleangetUseCompact()Returns whether to use compact format.StringglobalInfo()Returns a string describing the object.voidsetEncoding(BaseCharset value)Sets the encoding to use.voidsetUseCompact(boolean value)Sets whether to use compact format.protected StringtoCompactString(Actor actor)Turns the actor into a compact string.protected StringtoCompactString(List nested)Turns the nested format into a string.protected StringtoNestedString(List nested)Turns the nested format into a string.StringuseCompactTipText()Returns the tip text for this property.-
Methods inherited from class adams.data.io.output.AbstractNestedFlowWriter
write, write, write, write
-
Methods inherited from class adams.data.io.output.AbstractFlowWriter
getDefaultFormatExtension, getWriters, write, write, write, write
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, 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.Destroyable
destroy
-
Methods inherited from interface adams.core.io.FileFormatHandler
getDefaultFormatExtension
-
Methods inherited from interface adams.data.io.output.FlowWriter
write, write, write, write
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Encoding
protected BaseCharset m_Encoding
the encoding to use.
-
m_UseCompact
protected boolean m_UseCompact
whether to use compact format.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescriptionin interfaceFileFormatHandler- Specified by:
getFormatDescriptionin classAbstractFlowWriter- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensionsin interfaceFileFormatHandler- Specified by:
getFormatExtensionsin classAbstractFlowWriter- Returns:
- the extension (without the dot!)
-
getOutputType
protected AbstractFlowWriter.OutputType getOutputType()
Returns how to write the data, from a file, stream or writer.- Specified by:
getOutputTypein classAbstractFlowWriter- Returns:
- how to write the data
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setEncoding
public void setEncoding(BaseCharset value)
Sets the encoding to use.- Specified by:
setEncodingin interfaceEncodingSupporter- Parameters:
value- the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
-
getEncoding
public BaseCharset getEncoding()
Returns the encoding to use.- Specified by:
getEncodingin interfaceEncodingSupporter- Returns:
- the encoding, e.g. "UTF-8" or "UTF-16", empty string for default
-
encodingTipText
public String encodingTipText()
Returns the tip text for this property.- Specified by:
encodingTipTextin interfaceEncodingSupporter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultUseCompact
protected boolean getDefaultUseCompact()
Returns the default missing value.- Returns:
- the default for missing values
-
setUseCompact
public void setUseCompact(boolean value)
Sets whether to use compact format.- Parameters:
value- true if to use compact format
-
getUseCompact
public boolean getUseCompact()
Returns whether to use compact format.- Returns:
- true if compact format used
-
useCompactTipText
public String useCompactTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
toCompactString
protected String toCompactString(List nested)
Turns the nested format into a string.- Parameters:
nested- the nested format to convert- Returns:
- the generated string
-
toNestedString
protected String toNestedString(List nested)
Turns the nested format into a string.- Parameters:
nested- the nested format to convert- Returns:
- the generated string
-
doWrite
protected boolean doWrite(List content, File file)
Writes the given content to the specified file.- Overrides:
doWritein classAbstractNestedFlowWriter- Parameters:
content- the content to writefile- the file to write to- Returns:
- true if successfully written
-
doWrite
protected boolean doWrite(List content, Writer writer)
Performs the actual writing. The caller must ensure that the writer gets closed.- Overrides:
doWritein classAbstractNestedFlowWriter- Parameters:
content- the content to writewriter- the writer to write the content to- Returns:
- true if successfully written
-
doWrite
protected boolean doWrite(List content, OutputStream out)
Performs the actual writing. The caller must ensure that the output stream gets closed.- Overrides:
doWritein classAbstractNestedFlowWriter- Parameters:
content- the content to writeout- the output stream to write the content to- Returns:
- true if successfully written
-
toCompactString
protected String toCompactString(Actor actor)
Turns the actor into a compact string.- Parameters:
actor- the actor to convert- Returns:
- the
-
doWrite
protected boolean doWrite(Actor content, File file)
Writes the given content to the specified file.- Overrides:
doWritein classAbstractFlowWriter- Parameters:
content- the content to writefile- the file to write to- Returns:
- true if successfully written
-
doWrite
protected boolean doWrite(Actor content, Writer writer)
Performs the actual writing. The caller must ensure that the writer gets closed.- Overrides:
doWritein classAbstractFlowWriter- Parameters:
content- the content to writewriter- the writer to write the content to- Returns:
- true if successfully written
-
doWrite
protected boolean doWrite(Actor content, OutputStream out)
Performs the actual writing. The caller must ensure that the output stream gets closed.- Overrides:
doWritein classAbstractFlowWriter- Parameters:
content- the content to writeout- the output stream to write the content to- Returns:
- true if successfully written
-
getCorrespondingReader
public FlowReader getCorrespondingReader()
Returns the corresponding reader, if available.- Specified by:
getCorrespondingReaderin interfaceFlowWriter- Returns:
- the reader, null if none available
-
-