Class CsvUtils


  • public class CsvUtils
    extends java.lang.Object
    • Constructor Detail

      • CsvUtils

        public CsvUtils()
    • Method Detail

      • readCsvFileFromResource

        public static DataContainer readCsvFileFromResource​(java.lang.Class<?> clazz,
                                                            java.lang.String filename,
                                                            CsvFormat csvFormat,
                                                            float factor)
                                                     throws java.lang.NumberFormatException,
                                                            java.io.IOException
        Reads a CSV file from a JAR file.
        Parameters:
        clazz - a class in the same java package as the file
        filename - the name of the file in the java package
        csvFormat - the CSV-Format
        factor - a multiplication factor to apply on the read number
        Throws:
        java.io.IOException - on error
        java.lang.NumberFormatException - on error
      • readCsvFile

        public static DataContainer readCsvFile​(java.io.File path,
                                                CsvFormat csvFormat,
                                                float factor)
                                         throws java.lang.NumberFormatException,
                                                java.io.IOException
        Reads a CSV file.
        Parameters:
        path - the path + filename of the CSV file
        csvFormat - the CSV-Format
        factor - a multiplication factor to apply on the read number
        Throws:
        java.io.IOException - on error
        java.lang.NumberFormatException - on error
      • parseCsv

        public static DataContainer parseCsv​(java.lang.String csv,
                                             CsvFormat csvFormat,
                                             float factor)
                                      throws java.lang.NumberFormatException,
                                             java.io.IOException
        Reads a CSV file.
        Parameters:
        csv - the CSV content
        csvFormat - the CSV-Format
        factor - a multiplication factor to apply on the read number
        Throws:
        java.io.IOException - on error
        java.lang.NumberFormatException - on error