Skip navigation links
Data In Motion GmbH
org.gecko.influxdb.api

Interface CSVReader

    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Default Methods 
      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) 
    • Method Detail

      • convert

        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
        The method to convert CSV file to a format which can then directly be used into the 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.
        Parameters:
        csvFilePath - the full path (path+name) of the .csv file
        separator - the separator used in the file to separate the different columns
        isHeader - a boolean to be set to true if the .csv file contains an header, false otherwise
        Returns:
        A map containing as many keys as the .csv columns and the corresponding lists of points as values.
        Throws:
        java.io.IOException
      • convert

        java.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
        The same as before but passing an InputStream instead of the file
        Parameters:
        inputStream -
        separator -
        isHeader -
        Returns:
        Throws:
        java.io.IOException
      • convert

        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)
                                                                          throws java.io.IOException
        The method to convert CSV file to a format which can then directly be used into the 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 data
        Parameters:
        csvFilePath - the full path (path+name) of the .csv file
        separator - the separator used in the file to separate the different columns
        isHeader - a boolean to be set to true if the .csv file contains an header, false otherwise
        Returns:
        A map containing as many keys as the .csv columns and the corresponding lists of points as values.
        Throws:
        java.io.IOException
      • convert

        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)
                                                                          throws java.io.IOException
        The same as before but passing an InputStream instead of the file
        Parameters:
        inputStream -
        convertOptions -
        Returns:
        Throws:
        java.io.IOException
      • createDefaultOptions

        static java.util.Map<java.lang.String,java.lang.Object> createDefaultOptions(java.lang.String separator,
                                                                                     boolean header)
Data In Motion GmbH all rights reserved

Data In Motion GmbH all rights reserved