CSVParser { protected boolean isNextCharacterEscapable(String nextLine, boolean inQuotes, int i) { return inQuotes && nextLine.length() > (i + 1) && (nextLine.charAt(i + 1) == quotechar || nextLine.charAt(i + 1) == this.escape); } CSVParser();  CSVParser(char separator);  CSVParser(char separator, char quotechar);  CSVParser(char separator, char quotechar, char escape);  CSVParser(char separator, char quotechar, char escape, boolean strictQuotes);  CSVParser(char separator, char quotechar, char escape, boolean strictQuotes, boolean ignoreLeadingWhiteSpace);  CSVParser(char separator, char quotechar, char escape, boolean strictQuotes, boolean ignoreLeadingWhiteSpace,
                     boolean ignoreQuotations); boolean isPending(); String[] parseLineMulti(String nextLine); String[] parseLine(String nextLine); static final char DEFAULT_SEPARATOR; static final int INITIAL_READ_SIZE; static final char DEFAULT_QUOTE_CHARACTER; static final char DEFAULT_ESCAPE_CHARACTER; static final boolean DEFAULT_STRICT_QUOTES; static final boolean DEFAULT_IGNORE_LEADING_WHITESPACE; static final boolean DEFAULT_IGNORE_QUOTATIONS; }
@Test public void whichCharactersAreEscapable() { assertTrue(csvParser.isNextCharacterEscapable(ESCAPE_TEST_STRING, true, 0)); assertFalse(csvParser.isNextCharacterEscapable(ESCAPE_TEST_STRING, false, 0)); assertFalse(csvParser.isNextCharacterEscapable(ESCAPE_TEST_STRING, true, 1)); assertFalse(csvParser.isNextCharacterEscapable(ESCAPE_TEST_STRING, false, 1)); assertFalse(csvParser.isNextCharacterEscapable(ESCAPE_TEST_STRING, true, 3)); assertFalse(csvParser.isNextCharacterEscapable(ESCAPE_TEST_STRING, false, 3)); assertTrue(csvParser.isNextCharacterEscapable(ESCAPE_TEST_STRING, true, 5)); assertFalse(csvParser.isNextCharacterEscapable(ESCAPE_TEST_STRING, false, 5)); int lastChar = ESCAPE_TEST_STRING.length() - 1; assertFalse(csvParser.isNextCharacterEscapable(ESCAPE_TEST_STRING, true, lastChar)); assertFalse(csvParser.isNextCharacterEscapable(ESCAPE_TEST_STRING, false, lastChar)); }