private static ParserConfiguration generateParserSettings()

in c3r-sdk-core/src/main/java/com/amazonaws/c3r/io/CsvRowReader.java [205:247]


    private static ParserConfiguration generateParserSettings(final List<ColumnHeader> externalHeaders, final String inputNullValue) {
        final ParserConfiguration state = new ParserConfiguration();
        state.csvParserSettings = new CsvParserSettings();

        // configure reader settings
        state.csvParserSettings.setLineSeparatorDetectionEnabled(true);

        // `setNullValue` sets the value used when no characters appear in an entry (after trimming)
        // `setEmptyValue` sets the value used when no characters appear within a quoted entry (`,"",`)
        state.toNullConversionRequired = false;
        if (inputNullValue == null) {
            state.csvParserSettings.setNullValue(null);
            state.csvParserSettings.setEmptyValue(null);
        } else if (inputNullValue.isBlank()) {
            state.csvParserSettings.setNullValue(null);
            state.csvParserSettings.setEmptyValue("");
        } else if (inputNullValue.trim().equals("\"\"")) {
            state.csvParserSettings.setNullValue("");
            state.csvParserSettings.setEmptyValue(null);
        } else {
            state.csvParserSettings.setNullValue("");
            state.csvParserSettings.setEmptyValue("");
            state.toNullConversionRequired = true;
        }

        // Set maximum number of supported columns
        state.csvParserSettings.setMaxColumns(MAX_COLUMN_COUNT);

        // Disable the check for max chars per column. This is enforced by the Transformers as they're processed and may unnecessarily
        // restrict user data being used for column types like `fingerprint`.
        state.csvParserSettings.setMaxCharsPerColumn(-1);

        // Check if this is a positional file and turn off header extraction if it is
        state.csvParserSettings.setHeaderExtractionEnabled(externalHeaders == null);

        // Save custom null value for when we need it for substitution
        state.nullValue = inputNullValue;

        // Save the number of columns expected in a positional file
        state.numberOfColumns = (externalHeaders == null) ? null : externalHeaders.size();

        return state;
    }