Class SPCSpectrumReader.AbstractParser

    • Field Detail

      • m_Data

        protected byte[] m_Data
        the binary data to analyze.
      • m_Offset

        protected int m_Offset
        the offset to use.
      • m_BytesRead

        protected int m_BytesRead
        the number of bytes read.
    • Constructor Detail

      • AbstractParser

        protected AbstractParser​(SPCSpectrumReader.AbstractParser parent,
                                 byte[] data,
                                 int offset)
        Initializes the parser.
        Parameters:
        parent - the parent parser
        data - the data to analyze
        offset - the offset to use
    • Method Detail

      • sumBytes

        protected long sumBytes​(int start,
                                int len)
        Sums up the bytes.
        Parameters:
        start - the start index
        len - the number of bytes to sum up
        Returns:
        the sum
      • copyBytes

        protected byte[] copyBytes​(int start,
                                   int len)
        Copies the bytes into a new array.
        Parameters:
        start - the start index
        len - the number of bytes to copy
        Returns:
        the new array
      • parseHeader

        protected abstract String parseHeader()
        Parses the header data.
        Returns:
        null if successfully parsed, otherwise error message
      • parseData

        protected abstract String parseData()
        Parses the spectral data.
        Returns:
        null if successfully parsed, otherwise error message
      • parseFooter

        protected String parseFooter()
        Parses the footer data (if any).
        Returns:
        null if successfully parsed, otherwise error message
      • postProcess

        protected String postProcess()
        For post-processing the data.
        Returns:
        null if successfully parsed, otherwise error message
      • parse

        public String parse()
        Parses the data.
        Returns:
        null if successfully parsed, otherwise error message
      • getBytesRead

        public int getBytesRead()
        Returns the number of bytes that were read.
        Returns:
        the number of bytes