Class CSVConfigGuesser


  • public class CSVConfigGuesser
    extends Object
    Tries to guess a config based on an InputStream.
    • Field Detail

      • config

        protected CSVConfig config
        The found config
    • Constructor Detail

      • CSVConfigGuesser

        public CSVConfigGuesser()
      • CSVConfigGuesser

        public CSVConfigGuesser​(InputStream in)
        Parameters:
        in - the inputstream to guess from
    • Method Detail

      • setInputStream

        public void setInputStream​(InputStream in)
      • getInputStream

        protected InputStream getInputStream()
        Allow override.
        Returns:
        the inputstream that was set.
      • guess

        public CSVConfig guess()
        Guess the config based on the first 10 (or less when less available) records of a CSV file.
        Returns:
        the guessed config.
      • analyseLines

        protected void analyseLines​(String[] lines)
      • guessFixedWidth

        protected void guessFixedWidth​(String[] lines)
        Guess if this file is fixedwidth. Just basing the fact on all lines being of the same length
      • guessFieldSeparator

        protected void guessFieldSeparator​(String[] lines)
      • guessFixedWidthSeparator

        protected void guessFixedWidthSeparator​(String[] lines)
      • hasFieldHeader

        public boolean hasFieldHeader()
        Returns:
        if the field uses a field header. Defaults to false.
      • setHasFieldHeader

        public void setHasFieldHeader​(boolean hasFieldHeader)
        Specify if the CSV file has a field header
        Parameters:
        hasFieldHeader - true or false