Class TokenizedReader

  • All Implemented Interfaces:
    java.lang.AutoCloseable

    public class TokenizedReader
    extends BufferedLineReader
    Reader that will tokenize the input data as desired.
    Since:
    0.7.0
    Author:
    Erich Schubert
    • Field Detail

      • comment

        private java.util.regex.Matcher comment
        Comment pattern.
      • tokenizer

        protected Tokenizer tokenizer
        String tokenizer.
    • Constructor Detail

      • TokenizedReader

        public TokenizedReader​(java.util.regex.Pattern colSep,
                               java.lang.String quoteChars,
                               java.util.regex.Pattern comment)
        Constructor.
        Parameters:
        colSep - Column separator
        quoteChars - Quote character
        comment - Comment pattern
    • Method Detail

      • nextLineExceptComments

        public boolean nextLineExceptComments()
                                       throws java.io.IOException
        Read the next line into the tokenizer.
        Returns:
        The next line, or null.
        Throws:
        java.io.IOException
      • nextLine

        public boolean nextLine()
                         throws java.io.IOException
        Description copied from class: BufferedLineReader
        Read the next line.
        Overrides:
        nextLine in class BufferedLineReader
        Returns:
        true if another line was read successfully.
        Throws:
        java.io.IOException - on IO errors.
      • reset

        public void reset()
        Cleanup the internal state of the tokenized reader.

        This also closes the input stream, but the TokenizerReader can still be applied to a new stream using any of the reset() methods.

        Overrides:
        reset in class BufferedLineReader
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Overrides:
        close in class BufferedLineReader
        Throws:
        java.io.IOException
      • getTokenizer

        public Tokenizer getTokenizer()
        Get the tokenizer of the reader.
        Returns:
        Tokenizer