private void printWithQuotes()

in src/main/java/org/apache/commons/csv/CSVFormat.java [2514:2532]


    private void printWithQuotes(final Reader reader, final Appendable appendable) throws IOException {
        if (getQuoteMode() == QuoteMode.NONE) {
            printWithEscapes(reader, appendable);
            return;
        }
        final char quote = getQuoteCharacter().charValue(); // Explicit (un)boxing is intentional
        // (1) Append opening quote
        append(quote, appendable);
        // (2) Append Reader contents, doubling quotes
        int c;
        while (EOF != (c = reader.read())) {
            append((char) c, appendable);
            if (c == quote) {
                append(quote, appendable);
            }
        }
        // (3) Append closing quote
        append(quote, appendable);
    }