Skip to content

Commit

Permalink
Better internal names.
Browse files Browse the repository at this point in the history
  • Loading branch information
garydgregory committed Jul 11, 2021
1 parent 8a5a065 commit 3b95962
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/main/java/org/apache/commons/csv/CSVPrinter.java
Expand Up @@ -70,7 +70,7 @@
public final class CSVPrinter implements Flushable, Closeable {

/** The place that the values get written. */
private final Appendable out;
private final Appendable appendable;
private final CSVFormat format;

/** True if we just began a new record. */
Expand All @@ -83,7 +83,7 @@ public final class CSVPrinter implements Flushable, Closeable {
* and escaping with a different character) are not supported.
* </p>
*
* @param out
* @param appendable
* stream to which to print. Must not be null.
* @param format
* the CSV format. Must not be null.
Expand All @@ -92,11 +92,11 @@ public final class CSVPrinter implements Flushable, Closeable {
* @throws IllegalArgumentException
* thrown if the parameters of the format are inconsistent or if either out or format are null.
*/
public CSVPrinter(final Appendable out, final CSVFormat format) throws IOException {
Objects.requireNonNull(out, "out");
public CSVPrinter(final Appendable appendable, final CSVFormat format) throws IOException {
Objects.requireNonNull(appendable, "appendable");
Objects.requireNonNull(format, "format");

this.out = out;
this.appendable = appendable;
this.format = format;
// TODO: Is it a good idea to do this here instead of on the first call to a print method?
// It seems a pain to have to track whether the header has already been printed or not.
Expand Down Expand Up @@ -127,8 +127,8 @@ public void close(final boolean flush) throws IOException {
if (flush || format.getAutoFlush()) {
flush();
}
if (out instanceof Closeable) {
((Closeable) out).close();
if (appendable instanceof Closeable) {
((Closeable) appendable).close();
}
}

Expand All @@ -140,8 +140,8 @@ public void close(final boolean flush) throws IOException {
*/
@Override
public void flush() throws IOException {
if (out instanceof Flushable) {
((Flushable) out).flush();
if (appendable instanceof Flushable) {
((Flushable) appendable).flush();
}
}

Expand All @@ -151,7 +151,7 @@ public void flush() throws IOException {
* @return the target Appendable.
*/
public Appendable getOut() {
return this.out;
return this.appendable;
}

/**
Expand All @@ -163,7 +163,7 @@ public Appendable getOut() {
* If an I/O error occurs
*/
public void print(final Object value) throws IOException {
format.print(value, out, newRecord);
format.print(value, appendable, newRecord);
newRecord = false;
}

Expand Down Expand Up @@ -195,8 +195,8 @@ public void printComment(final String comment) throws IOException {
if (!newRecord) {
println();
}
out.append(format.getCommentMarker().charValue());
out.append(SP);
appendable.append(format.getCommentMarker().charValue());
appendable.append(SP);
for (int i = 0; i < comment.length(); i++) {
final char c = comment.charAt(i);
switch (c) {
Expand All @@ -207,11 +207,11 @@ public void printComment(final String comment) throws IOException {
//$FALL-THROUGH$ break intentionally excluded.
case LF:
println();
out.append(format.getCommentMarker().charValue());
out.append(SP);
appendable.append(format.getCommentMarker().charValue());
appendable.append(SP);
break;
default:
out.append(c);
appendable.append(c);
break;
}
}
Expand All @@ -237,7 +237,7 @@ public void printHeaders(final ResultSet resultSet) throws IOException, SQLExcep
* If an I/O error occurs
*/
public void println() throws IOException {
format.println(out);
format.println(appendable);
newRecord = true;
}

Expand Down

0 comments on commit 3b95962

Please sign in to comment.