base metadata instance. Copies with different format parameters will be created from this using LocaleTableMetadata.withFormatParameters. Idea is that you client have custom metadata subclass and use this parameter to set initial values for custom fields in the metadata.
user provided method that constructs a TableReader using locales, separator and charset specified by LocaleTableMetadata parameter.
List of locales to try for cellTypeLocale
and dataLocale
.
The default is CsvConstants.commonLocales.
List of charsets to try. Default is CsvConstants.commonCharsets.
List of separators to try. Default is CsvConstants.commonSeparators.
List of charsets to try.
List of charsets to try. Default is CsvConstants.commonCharsets.
base metadata instance.
base metadata instance. Copies with different format parameters will be created from this using LocaleTableMetadata.withFormatParameters. Idea is that you client have custom metadata subclass and use this parameter to set initial values for custom fields in the metadata.
List of locales to try for cellTypeLocale
and dataLocale
.
List of locales to try for cellTypeLocale
and dataLocale
.
The default is CsvConstants.commonLocales.
The main method in this class.
The main method in this class. Can be called several times. The input stream is may be opened and closed many times per each call.
If there are no errors TableReadingErrors.noErrors is true
.
a pair with a .TableReader and TableReadingErrors.
This method extends the basic read
method with exception based error handling,
which may be useful in smaller applications that don't expect or handle
errors in input.
This method extends the basic read
method with exception based error handling,
which may be useful in smaller applications that don't expect or handle
errors in input.
A RuntimeException
will be thrown when error is encountered.
List of separators to try.
List of separators to try. Default is CsvConstants.commonSeparators.
user provided method that constructs a TableReader using locales, separator and charset specified by LocaleTableMetadata parameter.
This CSV format detection heuristic tries to read the input CSV with varying parameters until a
Table
is produced with no errors or all combinations are exhausted. In the latter case theTable
with least errors is returned.For simpler usage you can skip
initialMetadata
in the constructor by using the apply method defined in the companion object.The interface of this class is similar to the one in TableReader, but this class creates multiple
TableReader
instances under the hood.Example on detection of CSV format
This example detects and parses a weird CSV format in which the separator is the one used at least in the finnish locale, but numeric data is formatted in english style. The column types are defined on the first row and the row type is defined by the first column.
The client specific row type.
The client specific column type.
The type of the
metadata
parameter. Must be a sub type of LocaleTableMetadata. This is used to manage the character set, separator,cellTypeLocale
anddataLocale
combinations when attempting to read the CSV data from the input stream.