public interface CSVReader
InfluxDBEntryHelper.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
PROP_HEADER |
static java.lang.String |
PROP_SEPARATOR |
static java.lang.String |
PROP_TYPE_ARRAY |
| Modifier and Type | Method and Description |
|---|---|
java.util.Map<java.lang.String,java.util.List<java.lang.Object>> |
convert(java.io.InputStream inputStream,
java.util.Map<java.lang.String,java.lang.Object> convertOptions)
The same as before but passing an InputStream instead of the file
|
java.util.Map<java.lang.String,java.util.List<java.lang.Object>> |
convert(java.io.InputStream inputStream,
java.lang.String separator,
boolean isHeader)
The same as before but passing an InputStream instead of the file
|
java.util.Map<java.lang.String,java.util.List<java.lang.Object>> |
convert(java.lang.String csvFilePath,
java.util.Map<java.lang.String,java.lang.Object> convertOptions)
The method to convert CSV file to a format which can then directly be used into the
InfluxDBEntryHelper |
java.util.Map<java.lang.String,java.util.List<java.lang.Object>> |
convert(java.lang.String csvFilePath,
java.lang.String separator,
boolean isHeader)
The method to convert CSV file to a format which can then directly be used into the
InfluxDBEntryHelper |
static java.util.Map<java.lang.String,java.lang.Object> |
createDefaultOptions(java.lang.String separator,
boolean header) |
static final java.lang.String PROP_HEADER
static final java.lang.String PROP_SEPARATOR
static final java.lang.String PROP_TYPE_ARRAY
java.util.Map<java.lang.String,java.util.List<java.lang.Object>> convert(java.lang.String csvFilePath,
java.lang.String separator,
boolean isHeader)
throws java.io.IOException
InfluxDBEntryHelper.
The first parameter to be provided is the full path (path+name) of the .csv file.
The second parameter is the separator used in the file to separate the different columns ("," for instance).
The third parameter has to be passed as true if the .csv file contains an header with the columns
names. In this case the returning map keys will be the same columns names in the header.
If set to false, it means the .csv file has no header (the first line is already made of data
to be stored). In this case the returning map keys will be called as "column0", "column1", etc.csvFilePath - the full path (path+name) of the .csv fileseparator - the separator used in the file to separate the different columnsisHeader - a boolean to be set to true if the .csv file contains an header, false otherwisejava.io.IOExceptionjava.util.Map<java.lang.String,java.util.List<java.lang.Object>> convert(java.io.InputStream inputStream,
java.lang.String separator,
boolean isHeader)
throws java.io.IOException
inputStream - separator - isHeader - java.io.IOExceptionjava.util.Map<java.lang.String,java.util.List<java.lang.Object>> convert(java.lang.String csvFilePath,
java.util.Map<java.lang.String,java.lang.Object> convertOptions)
throws java.io.IOException
InfluxDBEntryHelper.
The first parameter to be provided is the full path (path+name) of the .csv file.
The second parameter is a map with the options. In particular this method has to be preferred with respect to
convert(String csvFilePath, String separator, boolean isHeader) when the columns of the CSV file do not
contain only String data types. In this case an array of data type could be provided, which corresponds to the data type
of the different file columns. The String will be parsed as the corresponding data type, if possible, allowing later
to store the data in the InfluxDB with the correct data type.
This is of particular relevance if the user thinks about using math operator when displaying the data (for instance in
Grafana). No math operation is allowed in the InfluxDB for fields which are saved as String, so if you need to display
an average value, for instance, at some point, you would need to store the datacsvFilePath - the full path (path+name) of the .csv fileseparator - the separator used in the file to separate the different columnsisHeader - a boolean to be set to true if the .csv file contains an header, false otherwisejava.io.IOExceptionjava.util.Map<java.lang.String,java.util.List<java.lang.Object>> convert(java.io.InputStream inputStream,
java.util.Map<java.lang.String,java.lang.Object> convertOptions)
throws java.io.IOException
inputStream - convertOptions - java.io.IOExceptionstatic java.util.Map<java.lang.String,java.lang.Object> createDefaultOptions(java.lang.String separator,
boolean header)
Data In Motion GmbH all rights reserved