Interface CSVFile

  • All Known Implementing Classes:
    AbstractCSVFile, CSVFileReferenceOpenCSVImpl, CSVFileReferenceUnivocityImpl

    public interface CSVFile
    Interface 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 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.FileNotFoundException
        java.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 new ICSVReader that can be used to read through the input stream. The caller is responsible for calling ICSVReader.close() on the reader.
        Parameters:
        config -
        Returns:
        Throws:
        java.io.IOException
      • getCSV

        ICSV getCSV()
        Returns:
        the CSV reader/writer interface used for this CSVFile