Class CSVComparer
Object
CSVComparer
Compares two CSV files to determine if they are identical or not.
-
Constructor Summary
ConstructorsConstructorDescriptionCSVComparer
(String regExSeperator, boolean firstLineHeaders, int ignoreFirstNumberColumns, boolean sortLines, boolean rejectZeroRows) Creates a newCSVComparer
instance. -
Method Summary
Modifier and TypeMethodDescriptionboolean
areCSVFilesEqual
(Path path1, Path path2, PrintStream messageStream) Are two CSV files equal?
-
Constructor Details
-
CSVComparer
public CSVComparer(String regExSeperator, boolean firstLineHeaders, int ignoreFirstNumberColumns, boolean sortLines, boolean rejectZeroRows) Creates a newCSVComparer
instance.- Parameters:
regExSeperator
- The separator for the CSV file (a regular expression for split function)firstLineHeaders
- Whether the first line of the CSV file headersignoreFirstNumberColumns
- Ignore the first number of columns (left most) when measuring equalitysortLines
- If true, all lines in the CSV file are sorted before comparison. If false, the order remains unchanged.rejectZeroRows
- An exception is thrown if the CSV file has zero rows
-
-
Method Details
-
areCSVFilesEqual
public boolean areCSVFilesEqual(Path path1, Path path2, PrintStream messageStream) throws CSVReaderException Are two CSV files equal?- Parameters:
path1
- path to first file to compare, without any lines having been already readpath2
- path to second file to compare, without any lines having been already readmessageStream
- if CSV files aren't equal, additional explanation messages are printed here- Returns:
- true iff the two files are considered equal.
- Throws:
CSVReaderException
- if something goes wrong.
-