Class AbstractTextBasedSpectrumWriter

  • All Implemented Interfaces:
    adams.core.AdditionalInformationHandler, adams.core.CleanUpHandler, adams.core.Destroyable, adams.core.GlobalInfoSupporter, adams.core.io.FileFormatHandler, adams.core.logging.LoggingLevelHandler, adams.core.logging.LoggingSupporter, adams.core.option.OptionHandler, adams.core.ShallowCopySupporter<adams.data.io.output.DataContainerWriter>, adams.core.SizeOfHandler, adams.data.io.output.DataContainerWriter<Spectrum>, adams.data.io.output.StreamableDataContainerWriter<Spectrum>, adams.data.io.output.StreamableTextBasedDataContainerWriter<Spectrum>, Serializable, Comparable
    Direct Known Subclasses:
    ASCIIXYSpectrumWriter, ASCSpectrumWriter, DPTSpectrumWriter, JsonSpectrumWriter, TrinamixSpectrumWriter

    public abstract class AbstractTextBasedSpectrumWriter
    extends AbstractSpectrumWriter
    implements adams.data.io.output.StreamableTextBasedDataContainerWriter<Spectrum>
    Ancestor for text-based spectrum writers that support streaming.
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class adams.data.io.output.AbstractDataContainerWriter

        m_Output, m_OutputIsFile
      • Fields inherited from class adams.core.option.AbstractOptionHandler

        m_OptionManager
      • Fields inherited from class adams.core.logging.LoggingObject

        m_Logger, m_LoggingIsEnabled, m_LoggingLevel
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean write​(OutputStream stream, Spectrum data)
      Performs checks and writes the data to the stream.
      boolean write​(OutputStream stream, List<Spectrum> data)
      Performs checks and writes the data to the stream.
      protected boolean writeData​(List<Spectrum> data)
      Performs the actual writing.
      protected abstract boolean writeData​(List<Spectrum> data, Writer writer)
      Performs the actual writing.
      • Methods inherited from class adams.data.io.output.AbstractDataContainerWriter

        checkData, cleanUp, compareTo, defineOptions, destroy, equals, forCommandLine, forName, getAdditionalInformation, getDefaultFormatExtension, getFormatDescription, getFormatExtensions, getOutput, isOutputFile, reset, setOutput, shallowCopy, shallowCopy, write, write
      • Methods inherited from class adams.core.option.AbstractOptionHandler

        cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, initialize, loggingLevelTipText, newOptionManager, setLoggingLevel, toCommandLine, toString
      • Methods inherited from class adams.core.logging.LoggingObject

        configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
      • Methods inherited from interface adams.core.AdditionalInformationHandler

        getAdditionalInformation
      • Methods inherited from interface adams.core.CleanUpHandler

        cleanUp
      • Methods inherited from interface adams.data.io.output.DataContainerWriter

        canWriteMultiple, getOutput, isOutputFile, outputTipText, setOutput, write, write
      • Methods inherited from interface adams.core.Destroyable

        destroy
      • Methods inherited from interface adams.core.io.FileFormatHandler

        getDefaultFormatExtension, getFormatDescription, getFormatExtensions
      • Methods inherited from interface adams.core.logging.LoggingLevelHandler

        getLoggingLevel
      • Methods inherited from interface adams.core.option.OptionHandler

        cleanUpOptions, defineOptions, getOptionManager, toCommandLine
      • Methods inherited from interface adams.core.ShallowCopySupporter

        shallowCopy, shallowCopy
    • Constructor Detail

      • AbstractTextBasedSpectrumWriter

        public AbstractTextBasedSpectrumWriter()
    • Method Detail

      • writeData

        protected abstract boolean writeData​(List<Spectrum> data,
                                             Writer writer)
        Performs the actual writing.
        Parameters:
        data - the data to write
        writer - the writer to write the spectra to
        Returns:
        true if successfully written
      • writeData

        protected boolean writeData​(List<Spectrum> data)
        Performs the actual writing.
        Specified by:
        writeData in class adams.data.io.output.AbstractDataContainerWriter<Spectrum>
        Parameters:
        data - the data to write
        Returns:
        true if successfully written
      • write

        public boolean write​(OutputStream stream,
                             Spectrum data)
        Performs checks and writes the data to the stream.
        Specified by:
        write in interface adams.data.io.output.StreamableDataContainerWriter<Spectrum>
        Parameters:
        stream - the stream to write to
        data - the data to write
        Returns:
        true if successfully written
        See Also:
        write(OutputStream stream, List)
      • write

        public boolean write​(OutputStream stream,
                             List<Spectrum> data)
        Performs checks and writes the data to the stream.
        Specified by:
        write in interface adams.data.io.output.StreamableDataContainerWriter<Spectrum>
        Parameters:
        stream - the stream to write to
        data - the data to write
        Returns:
        true if successfully written