Package org.processmining.log.csv
Interface CSVFile
-
- All Known Implementing Classes:
AbstractCSVFile,CSVFileReferenceOpenCSVImpl,CSVFileReferenceUnivocityImpl
public interface CSVFileInterface for a CSV file managed in the ProM environment. Example usage:CSVFile file; // get it from a plug-in // Prepare config with auto guessing of encoding etc. CSVConfig importConfig = new CSVConfig(csvFile); // Read header try { String[] header = csvFile.readHeader(importConfig); } catch (IOException e) { // do someting } // Read content try (ICSVReader reader = csvFile.createReader(importConfig)) { while ((nextLine = reader.readNext()) != null) { // do something } }- Author:
- F. Mannhardt
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ICSVReadercreateReader(CSVConfig config)Returns a newICSVReaderthat can be used to read through the input stream.ICSVgetCSV()java.nio.file.PathgetFile()java.lang.StringgetFilename()java.io.InputStreamgetInputStream()java.lang.String[]readHeader(CSVConfig config)Returns the first row of the CSV file.
-
-
-
Method Detail
-
getFile
java.nio.file.Path getFile()
- Returns:
- the complete path to the CSV file (including the file itself)
-
getFilename
java.lang.String getFilename()
- Returns:
- the filename with extension
-
getInputStream
java.io.InputStream getInputStream() throws java.io.FileNotFoundException, java.io.IOException- Returns:
- input stream of this CSV file
- Throws:
java.io.FileNotFoundExceptionjava.io.IOException
-
readHeader
java.lang.String[] readHeader(CSVConfig config) throws java.io.IOException
Returns the first row of the CSV file.- Parameters:
config-- Returns:
- Throws:
java.io.IOException
-
createReader
ICSVReader createReader(CSVConfig config) throws java.io.IOException
Returns a newICSVReaderthat can be used to read through the input stream. The caller is responsible for callingICSVReader.close()on the reader.- Parameters:
config-- Returns:
- Throws:
java.io.IOException
-
-