Class FileXPorter

java.lang.Object
clazzfish.core.spi.FileXPorter
All Implemented Interfaces:
CsvXPorter

public class FileXPorter extends Object implements CsvXPorter
The class FileXPorter accepts a file URI to import and export CSV data.
Since:
2.5 (18.02.25)
Author:
oboehm
  • Constructor Details

    • FileXPorter

      public FileXPorter(File file)
    • FileXPorter

      public FileXPorter(URI uri)
  • Method Details

    • getURI

      public URI getURI()
      Description copied from interface: CsvXPorter
      Simple getter for the import and export URI.
      Specified by:
      getURI in interface CsvXPorter
      Returns:
      URI
    • withURI

      public FileXPorter withURI(URI csvURI)
      Description copied from interface: CsvXPorter
      Returns a (new) CsvXPorter with new URI.
      Specified by:
      withURI in interface CsvXPorter
      Parameters:
      csvURI - URI of the returned CsvXPorter
      Returns:
      usually a new CsvXPorter
    • exportCSV

      public void exportCSV(URI uri, String csvHeadLine, List<String> csvLines) throws IOException
      Description copied from interface: CsvXPorter
      Interface for exporting CSV.
      Specified by:
      exportCSV in interface CsvXPorter
      Parameters:
      uri - URI wher the CSV should be exported to
      csvHeadLine - CSV header
      csvLines - CSV lines
      Throws:
      IOException - in case of I/O problems
    • importCSV

      public List<String> importCSV(URI uri) throws IOException
      Description copied from interface: CsvXPorter
      Interface for importing a CSV. This method should be called in CsvXPorter.exportCSV(URI, String, List) to aggregate the count of the actual export with former exports.
      Specified by:
      importCSV in interface CsvXPorter
      Parameters:
      uri - URI where the CSV should be imported from
      Returns:
      list of CSV lines (including head line)
      Throws:
      IOException - in case of I/O problems
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object