Class ParserOutput

    • Field Detail

      • column

        protected int column
        Keeps track of the current column being parsed in the input. Calls to valueParsed() and emptyParsed() will increase the column count. This value is reset to zero after a row is parsed.
      • parsedValues

        protected final java.lang.String[] parsedValues
        Stores the values parsed for a record.
      • skipEmptyLines

        private final boolean skipEmptyLines
      • nullValue

        private final java.lang.String nullValue
      • appender

        public CharAppender appender

        The appender available to parsers for accumulating characters read from the input.

        This attribute is assigned to different instances of CharAppender during parsing process, namely, a (potentially) different CharAppender for each parsed column, taken from appenders[column]

      • appenderInstance

        private final CharAppender appenderInstance
      • columnsToExtractInitialized

        private boolean columnsToExtractInitialized
      • columnsReordered

        private boolean columnsReordered
      • columnReorderingEnabledSetting

        private boolean columnReorderingEnabledSetting
      • headerStrings

        private java.lang.String[] headerStrings
      • selectedIndexes

        private int[] selectedIndexes
      • currentRecord

        private long currentRecord
      • trim

        public boolean trim
      • pendingRecords

        public final java.util.Deque<java.lang.String[]> pendingRecords
    • Constructor Detail

      • ParserOutput

        public ParserOutput​(CommonParserSettings<?> settings)
        Initializes the ParserOutput with the configuration specified in CommonParserSettings
        Parameters:
        settings - the parser configuration
      • ParserOutput

        public ParserOutput​(AbstractParser<?> parser,
                            CommonParserSettings<?> settings)
        Initializes the ParserOutput with the configuration specified in CommonParserSettings
        Parameters:
        parser - the parser whose output will be managed by this class.
        settings - the parser configuration
    • Method Detail

      • initializeHeaders

        protected void initializeHeaders()
      • rowParsed

        public java.lang.String[] rowParsed()
        Gets all values parsed in the parsedValues array
        Returns:
        the sequence of parsed values in a record.
      • initializeColumnsToExtract

        private void initializeColumnsToExtract​(NormalizedString[] values)
        Initializes the sequence of selected fields, if any.
        Parameters:
        values - a sequence of values that represent the headers of the input. This can be either a parsed record or the headers as defined in CommonSettings.getHeaders()
      • getHeaderAsStringArray

        public java.lang.String[] getHeaderAsStringArray()
      • getHeaders

        public NormalizedString[] getHeaders()
        Returns the sequence of values that represent the headers each field in the input. This can be either a parsed record or the headers as defined in CommonSettings.getHeaders()
        Returns:
        the headers each field in the input
      • getSelectedIndexes

        public int[] getSelectedIndexes()
        Returns the selected indexes of all fields as defined in CommonSettings. Null if no fields were selected.
        Returns:
        the selected indexes of all fields as defined in CommonSettings. Null if no fields were selected.
      • getCurrentColumn

        public int getCurrentColumn()
        Returns the position of the current parsed value
        Returns:
        the position of the current parsed value
      • emptyParsed

        public void emptyParsed()
        Adds a nullValue (as specified in CommonSettings.getNullValue()) to the output and prepares the next position in the record to receive more values.
      • valueParsed

        public void valueParsed()
        Adds the accumulated value in the appender object to the output and prepares the next position in the record to receive more values.
      • valueParsed

        public void valueParsed​(java.lang.String value)
        Adds a value processed externally to the output and prepares the next position in the record to receive more values
        Parameters:
        value - the value to be added to the current record position.
      • getCurrentRecord

        public long getCurrentRecord()
        Returns the current record index. The number returned here reflects the number of actually parsed and valid records sent to the output of rowParsed().
        Returns:
        the current record index.
      • discardValues

        public final void discardValues()
        Discards the values parsed so far
      • reset

        final void reset()
        Resets the parser output and prepares for a new parsing process.