Class SimpleSpectrumReader

  • 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.input.AbstractDataContainerReader>, adams.core.SizeOfHandler, adams.core.Stoppable, Serializable, Comparable

    public class SimpleSpectrumReader
    extends AbstractSpectrumReader
    Reads spectrums in the internal CSV format.

    Valid options are:

    -D (property: debug)
             If set to true, scheme may output additional info to the console.
     
    -input <java.io.File> (property: input)
             The file to read and turn into a spectrum.
             default: .
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Constructor Detail

      • SimpleSpectrumReader

        public SimpleSpectrumReader()
    • Method Detail

      • globalInfo

        public String globalInfo()
        Returns a string describing the object.
        Specified by:
        globalInfo in interface adams.core.GlobalInfoSupporter
        Specified by:
        globalInfo in class adams.core.option.AbstractOptionHandler
        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:
        getFormatDescription in interface adams.core.io.FileFormatHandler
        Specified by:
        getFormatDescription in class adams.data.io.input.AbstractDataContainerReader<Spectrum>
        Returns:
        a description suitable for displaying in the file chooser
      • getFormatExtensions

        public String[] getFormatExtensions()
        Returns the extension(s) of the format.
        Specified by:
        getFormatExtensions in interface adams.core.io.FileFormatHandler
        Specified by:
        getFormatExtensions in class adams.data.io.input.AbstractDataContainerReader<Spectrum>
        Returns:
        the extension(s) (without the dot!)
      • read

        protected boolean read​(BufferedReader reader)
        Reads its content from the given reader.
        Parameters:
        reader - the reader to use
        Returns:
        true if successfully read
      • read

        protected boolean read​(String filename)
        Reads its content from the given file.
        Parameters:
        filename - the file to read from
        Returns:
        true if successfully read
      • readData

        protected void readData()
        Performs the actual reading.
        Specified by:
        readData in class adams.data.io.input.AbstractDataContainerReader<Spectrum>
      • main

        public static void main​(String[] args)
        Runs the reader from the command-line. If the option AbstractSpectrumReader.OPTION_OUTPUTDIR is specified then the read spectra get output as .spec files in that directory.
        Parameters:
        args - the command-line options to use