Package io.openems.edge.simulator
Class CsvUtils
- java.lang.Object
-
- io.openems.edge.simulator.CsvUtils
-
public class CsvUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description CsvUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static DataContainer
parseCsv(java.lang.String csv, CsvFormat csvFormat, float factor)
Reads a CSV file.static DataContainer
readCsvFile(java.io.File path, CsvFormat csvFormat, float factor)
Reads a CSV file.static DataContainer
readCsvFileFromResource(java.lang.Class<?> clazz, java.lang.String filename, CsvFormat csvFormat, float factor)
Reads a CSV file from a JAR file.
-
-
-
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 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:
java.io.IOException
- on errorjava.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 filecsvFormat
- the CSV-Formatfactor
- a multiplication factor to apply on the read number- Returns:
- a
DataContainer
- Throws:
java.io.IOException
- on errorjava.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 contentcsvFormat
- the CSV-Formatfactor
- a multiplication factor to apply on the read number- Returns:
- a
DataContainer
- Throws:
java.io.IOException
- on errorjava.lang.NumberFormatException
- on error
-
-