Class NoopParsingContext

    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private NoopParsingContext()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean columnsReordered()
      Indicates whether selected fields (using CommonSettings.selectFields(java.lang.String...) and friends) are being reordered.
      java.util.Map<java.lang.Long,​java.lang.String> comments()
      Returns all comments collected by the parser so far.
      long currentChar()
      Returns the index of the last char read from the input so far.
      int currentColumn()
      Returns the column index of the record being processed.
      long currentLine()
      Returns the current line of text being processed by the parser
      java.lang.String currentParsedContent()
      Returns a String with the input character sequence parsed to produce the current record.
      int currentParsedContentLength()
      Returns the length of the character sequence parsed to produce the current record.
      long currentRecord()
      Returns the index of the last valid record parsed from the input
      int errorContentLength()
      Returns the length limit of parsed contents appearing in exception messages when an error occurs
      int[] extractedFieldIndexes()
      Returns the indexes of each field extracted from the input when fields are selected in the parser settings (i.e.
      java.lang.String fieldContentOnError()
      Returns a String with the input character sequence accumulated on a field before TextParsingException occurred.
      java.lang.String[] headers()
      Returns the file headers that identify each parsed record.
      int indexOf​(java.lang.Enum<?> header)
      Returns the position of a header (0 based).
      int indexOf​(java.lang.String header)
      Returns the position of a header (0 based).
      boolean isStopped()
      Identifies whether the parser is running.
      java.lang.String lastComment()
      Returns the last comment found in the input.
      char[] lineSeparator()
      Returns the line separator characters used to separate individual records when parsing.
      java.lang.String[] parsedHeaders()
      Returns the headers parsed from the input, if and only if CommonParserSettings.headerExtractionEnabled is true.
      RecordMetaData recordMetaData()
      Returns the metadata information associated with records produced by the current parsing process.
      java.lang.String[] selectedHeaders()
      Returns the sequence of headers that have been selected.
      void skipLines​(long lines)
      Skips a given number of lines from the current position.
      void stop()
      Stops the parsing process.
      Record toRecord​(java.lang.String[] row)
      Converts the given parsed row to a Record
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NoopParsingContext

        private NoopParsingContext()
    • Method Detail

      • isStopped

        public boolean isStopped()
        Description copied from interface: Context
        Identifies whether the parser is running.
        Specified by:
        isStopped in interface Context
        Returns:
        true if the parser is stopped, false otherwise.
      • currentLine

        public long currentLine()
        Description copied from interface: ParsingContext
        Returns the current line of text being processed by the parser
        Specified by:
        currentLine in interface ParsingContext
        Returns:
        current line of text being processed by the parser
      • currentChar

        public long currentChar()
        Description copied from interface: ParsingContext
        Returns the index of the last char read from the input so far.
        Specified by:
        currentChar in interface ParsingContext
        Returns:
        the index of the last char read from the input so far.
      • currentColumn

        public int currentColumn()
        Description copied from interface: Context
        Returns the column index of the record being processed.
        Specified by:
        currentColumn in interface Context
        Returns:
        the column index of the record being processed.
      • currentRecord

        public long currentRecord()
        Description copied from interface: Context
        Returns the index of the last valid record parsed from the input
        Specified by:
        currentRecord in interface Context
        Returns:
        the index of the last valid record parsed from the input
      • skipLines

        public void skipLines​(long lines)
        Description copied from interface: ParsingContext
        Skips a given number of lines from the current position.
        Specified by:
        skipLines in interface ParsingContext
        Parameters:
        lines - the number of lines to be skipped.
      • currentParsedContent

        public java.lang.String currentParsedContent()
        Description copied from interface: ParsingContext
        Returns a String with the input character sequence parsed to produce the current record.
        Specified by:
        currentParsedContent in interface ParsingContext
        Returns:
        the text content parsed for the current input record.
      • currentParsedContentLength

        public int currentParsedContentLength()
        Description copied from interface: ParsingContext
        Returns the length of the character sequence parsed to produce the current record.
        Specified by:
        currentParsedContentLength in interface ParsingContext
        Returns:
        the length of the text content parsed for the current input record
      • selectedHeaders

        public java.lang.String[] selectedHeaders()
        Description copied from interface: Context
        Returns the sequence of headers that have been selected. If no selection has been made, all available headers will be returned, producing the same output as a call to method Context.headers().
        Specified by:
        selectedHeaders in interface Context
        Returns:
        the sequence of selected headers, or all headers if no selection has been made.
      • extractedFieldIndexes

        public int[] extractedFieldIndexes()
        Description copied from interface: ParsingContext
        Returns the indexes of each field extracted from the input when fields are selected in the parser settings (i.e. using CommonSettings.selectFields(java.lang.String...) and friends).

        The indexes are relative to their original position in the input.

        For example, if the input has the fields "A, B, C, D", and the selected fields are "A, D", then the extracted field indexes will return [0, 3]

        If no fields were selected, then this method will return null. This means all fields are being parsed.

        Specified by:
        extractedFieldIndexes in interface Context
        Specified by:
        extractedFieldIndexes in interface ParsingContext
        Returns:
        The indexes of each selected field; null if no fields were selected.
        See Also:
        CommonSettings
      • indexOf

        public int indexOf​(java.lang.String header)
        Description copied from interface: Context
        Returns the position of a header (0 based).
        Specified by:
        indexOf in interface Context
        Parameters:
        header - the header whose position will be returned
        Returns:
        the position of the given header, or -1 if it could not be found.
      • indexOf

        public int indexOf​(java.lang.Enum<?> header)
        Description copied from interface: Context
        Returns the position of a header (0 based).
        Specified by:
        indexOf in interface Context
        Parameters:
        header - the header whose position will be returned
        Returns:
        the position of the given header, or -1 if it could not be found.
      • fieldContentOnError

        public java.lang.String fieldContentOnError()
        Description copied from interface: ParsingContext
        Returns a String with the input character sequence accumulated on a field before TextParsingException occurred.
        Specified by:
        fieldContentOnError in interface ParsingContext
        Returns:
        the text content parsed for the current field of the current input record at the time of the error.
      • errorContentLength

        public int errorContentLength()
        Description copied from interface: Context
        Returns the length limit of parsed contents appearing in exception messages when an error occurs

        If 0, then no exceptions will include the content being manipulated in their attributes, and the "<omitted>" string will appear in error messages as the parsed content.

        defaults to -1 (no limit)

        .
        Specified by:
        errorContentLength in interface Context
        Returns:
        the maximum length of the data content to display in exception messages
      • toRecord

        public Record toRecord​(java.lang.String[] row)
        Description copied from interface: Context
        Converts the given parsed row to a Record
        Specified by:
        toRecord in interface Context
        Parameters:
        row - the row to be converted into a Record
        Returns:
        a Record representing the given row.
      • recordMetaData

        public RecordMetaData recordMetaData()
        Description copied from interface: Context
        Returns the metadata information associated with records produced by the current parsing process.
        Specified by:
        recordMetaData in interface Context
        Returns:
        the record metadata.