Package io.openems.edge.simulator
Class CsvUtils
java.lang.Object
io.openems.edge.simulator.CsvUtils
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic DataContainer
Reads a CSV file.static DataContainer
readCsvFile
(File path, CsvFormat csvFormat, float factor) Reads a CSV file.static DataContainer
readCsvFileFromResource
(Class<?> clazz, String filename, CsvFormat csvFormat, float factor) Reads a CSV file from a JAR file.
-
Constructor Details
-
CsvUtils
public CsvUtils()
-
-
Method Details
-
readCsvFileFromResource
public static DataContainer readCsvFileFromResource(Class<?> clazz, String filename, CsvFormat csvFormat, float factor) throws NumberFormatException, IOException Reads a CSV file from a JAR file.- Parameters:
clazz
- a class in the same java package as the filefilename
- the name of the file in the java packagecsvFormat
- the CSV-Formatfactor
- a multiplication factor to apply on the read number- Returns:
- a
DataContainer
- Throws:
IOException
- on errorNumberFormatException
- on error
-
readCsvFile
public static DataContainer readCsvFile(File path, CsvFormat csvFormat, float factor) throws NumberFormatException, IOException Reads a CSV file.- Parameters:
path
- the path + filename of the CSV filecsvFormat
- the CSV-Formatfactor
- a multiplication factor to apply on the read number- Returns:
- a
DataContainer
- Throws:
IOException
- on errorNumberFormatException
- on error
-
parseCsv
public static DataContainer parseCsv(String csv, CsvFormat csvFormat, float factor) throws NumberFormatException, IOException Reads a CSV file.- Parameters:
csv
- the CSV contentcsvFormat
- the CSV-Formatfactor
- a multiplication factor to apply on the read number- Returns:
- a
DataContainer
- Throws:
IOException
- on errorNumberFormatException
- on error
-