Package com.illumon.iris.db.tables.utils
Class CsvParserFormat
java.lang.Object
com.illumon.iris.db.tables.utils.CsvParserFormat
Returns an Apache CSVFormat based on the fileFormat String.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic org.apache.commons.csv.CSVFormat
getCsvFormat
(String fileFormat, char delimiter, boolean trim, boolean noHeader, List<String> columnNames) Returns an Apache CSVFormat based on the fileFormat String.static String[]
static String
getRequiredDelimiter
(String fileFormat) For the specified file format, return the required delimiter if there is one
-
Field Details
-
FORMAT_BPIPE
- See Also:
-
-
Constructor Details
-
CsvParserFormat
public CsvParserFormat()
-
-
Method Details
-
getFormatNames
-
getCsvFormat
public static org.apache.commons.csv.CSVFormat getCsvFormat(String fileFormat, char delimiter, boolean trim, boolean noHeader, @Nullable List<String> columnNames) Returns an Apache CSVFormat based on the fileFormat String.- Parameters:
fileFormat
- The string for which a format should be createddelimiter
- A single character to use as a delimiter - comma when format will be controlled by fileFormattrim
- Whether to trim white space within delimitersnoHeader
- Indicates when the CSV does not include a row of column namescolumnNames
- A List of column names to use as a header- Returns:
- A CSVFormat object matching the passed String and trim option
- Throws:
RuntimeException
- if fileFormat is unrecognized
-
getRequiredDelimiter
For the specified file format, return the required delimiter if there is one- Parameters:
fileFormat
- the file format- Returns:
- the required delimiter, or null if it is not specified
-