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.
-
-
Constructor Summary
Constructors Constructor Description CSVConfigGuesser()
CSVConfigGuesser(InputStream in)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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
guessFieldSeparator(String[] lines)
protected void
guessFixedWidth(String[] lines)
Guess if this file is fixedwidth.protected void
guessFixedWidthSeparator(String[] lines)
boolean
hasFieldHeader()
void
setHasFieldHeader(boolean hasFieldHeader)
Specify if the CSV file has a field headervoid
setInputStream(InputStream in)
-
-
-
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
-
-