org.apache.solr.internal.csv.writer

## Class CSVConfigGuesser

- java.lang.Object
- - org.apache.solr.internal.csv.writer.CSVConfigGuesser

-     public class CSVConfigGuesser
      extends Object

  Tries to guess a config based on an InputStream.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected CSVConfig` | `config` The found config

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CSVConfigGuesser()`
    `CSVConfigGuesser(InputStream in)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `analyseLines(String[] lines)`
    `protected InputStream` | `getInputStream()` Allow override.
    `CSVConfig` | `guess()` Guess the config based on the first 10 (or less when less available) records of a CSV file.
    `protected void` | `guessFieldSeperator(String[] lines)`
    `protected void` | `guessFixedWidth(String[] lines)` Guess if this file is fixedwidth.
    `protected void` | `guessFixedWidthSeperator(String[] lines)`
    `boolean` | `hasFieldHeader()`
    `void` | `setHasFieldHeader(boolean hasFieldHeader)` Specify if the CSV file has a field header
    `void` | `setInputStream(InputStream in)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 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

    - #### guessFieldSeperator

          protected void guessFieldSeperator(String[] lines)

    - #### guessFixedWidthSeperator

          protected void guessFixedWidthSeperator(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

Copyright © 2000-2016 Apache Software Foundation. All Rights Reserved.