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 voidanalyseLines(String[] lines)protected InputStreamgetInputStream()Allow override.CSVConfigguess()Guess the config based on the first 10 (or less when less available) records of a CSV file.protected voidguessFieldSeparator(String[] lines)protected voidguessFixedWidth(String[] lines)Guess if this file is fixedwidth.protected voidguessFixedWidthSeparator(String[] lines)booleanhasFieldHeader()voidsetHasFieldHeader(boolean hasFieldHeader)Specify if the CSV file has a field headervoidsetInputStream(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
-
-