Migrating from 2.x
This document only describes the breaking changes when migrating from FastCSV 2.x to 3.x. For a full list of changes, including new features, see the changelog.
Requirement changes
- The minimum Java version is now 11 (compared to 8 in earlier versions)
- This also raised the required Android API level from version 26 (Android 8) to 33 (Android 13)
New limitations
- The maximum number of fields per record is now limited to 16,384 to avoid
OutOfMemoryErrors
caused by excessive field counts. - The maximum record size is now limited to (64 MiB) to prevent
OutOfMemoryErrors
.
Naming changes
Rows are now called Records (aligned to RFC 4180)
Reading CSV records:
Write CSV records:
Method names
- In
CsvReaderBuilder
:skipEmptyRows
is nowskipEmptyLines
errorOnDifferentFieldCount
is nowignoreDifferentFieldCount
(opposite meaning!)build
methods with callback handlers andofCsvRecord
/ofNamedCsvRecord
as convenience methods
- In
CsvRecord
(formerCsvRow
):getOriginalLineNumber
is nowgetStartingLineNumber
NamedCsvReader removed/replaced
A distinct NamedCsvReader
is no longer needed as the CsvReader
now supports callbacks for header and record
processing.
or with a custom header:
Extended/Refactored quote strategies
QuoteStrategy
changed from an enum to an interface (seeQuoteStrategies
for the default implementations)- The
REQUIRED
quote strategy is removed as it is the default (no quote strategy is needed)
Example to enable always quoting:
Exception changes
MalformedCsvException
is now CsvParseException
and is thrown instead of IOException
for non-IO related errors.