Class CSVFile


  • public final class CSVFile
    extends Object
    This class provides api to work with csv files using CSVParser and CSVPrinter.
    • Field Detail

      • DEFAULT

        public static final CSVFile DEFAULT
      • EXCEL

        public static final CSVFile EXCEL
    • Method Detail

      • withDelimiter

        public CSVFile withDelimiter​(char delimiter)
      • withEscape

        public CSVFile withEscape​(char escape)
      • withQuoteAll

        public CSVFile withQuoteAll()
      • withFirstRecordAsHeader

        public CSVFile withFirstRecordAsHeader()
      • stream

        public static Stream<org.apache.commons.csv.CSVRecord> stream​(org.apache.commons.csv.CSVParser parser)
        Return a stream of CSVRecord by filtering out empty records.
        Parameters:
        parser - the CSVParser
        Returns:
        stream of CSVRecord
      • header

        public static String[] header​(org.apache.commons.csv.CSVParser parser)
        Return header as array.
        Parameters:
        parser - the CSVParser
        Returns:
        array of header names
      • values

        public static String[] values​(org.apache.commons.csv.CSVRecord record)
        Return values as array.
        Parameters:
        record - the CSVRecord
        Returns:
        array of values
      • isEmpty

        public static boolean isEmpty​(org.apache.commons.csv.CSVRecord record)
        Check whether the record is empty.
        Parameters:
        record - the CSVRecord
        Returns:
        true if record is empty
      • notEmpty

        public static boolean notEmpty​(org.apache.commons.csv.CSVRecord record)
        Check whether the record is not empty.
        Parameters:
        record - the CSVRecord
        Returns:
        true if record is not empty