7070public final class CSVPrinter implements Flushable , Closeable {
7171
7272 /** The place that the values get written. */
73- private final Appendable out ;
73+ private final Appendable appendable ;
7474 private final CSVFormat format ;
7575
7676 /** True if we just began a new record. */
@@ -83,7 +83,7 @@ public final class CSVPrinter implements Flushable, Closeable {
8383 * and escaping with a different character) are not supported.
8484 * </p>
8585 *
86- * @param out
86+ * @param appendable
8787 * stream to which to print. Must not be null.
8888 * @param format
8989 * the CSV format. Must not be null.
@@ -92,11 +92,11 @@ public final class CSVPrinter implements Flushable, Closeable {
9292 * @throws IllegalArgumentException
9393 * thrown if the parameters of the format are inconsistent or if either out or format are null.
9494 */
95- public CSVPrinter (final Appendable out , final CSVFormat format ) throws IOException {
96- Objects .requireNonNull (out , "out " );
95+ public CSVPrinter (final Appendable appendable , final CSVFormat format ) throws IOException {
96+ Objects .requireNonNull (appendable , "appendable " );
9797 Objects .requireNonNull (format , "format" );
9898
99- this .out = out ;
99+ this .appendable = appendable ;
100100 this .format = format ;
101101 // TODO: Is it a good idea to do this here instead of on the first call to a print method?
102102 // It seems a pain to have to track whether the header has already been printed or not.
@@ -127,8 +127,8 @@ public void close(final boolean flush) throws IOException {
127127 if (flush || format .getAutoFlush ()) {
128128 flush ();
129129 }
130- if (out instanceof Closeable ) {
131- ((Closeable ) out ).close ();
130+ if (appendable instanceof Closeable ) {
131+ ((Closeable ) appendable ).close ();
132132 }
133133 }
134134
@@ -140,8 +140,8 @@ public void close(final boolean flush) throws IOException {
140140 */
141141 @ Override
142142 public void flush () throws IOException {
143- if (out instanceof Flushable ) {
144- ((Flushable ) out ).flush ();
143+ if (appendable instanceof Flushable ) {
144+ ((Flushable ) appendable ).flush ();
145145 }
146146 }
147147
@@ -151,7 +151,7 @@ public void flush() throws IOException {
151151 * @return the target Appendable.
152152 */
153153 public Appendable getOut () {
154- return this .out ;
154+ return this .appendable ;
155155 }
156156
157157 /**
@@ -163,7 +163,7 @@ public Appendable getOut() {
163163 * If an I/O error occurs
164164 */
165165 public void print (final Object value ) throws IOException {
166- format .print (value , out , newRecord );
166+ format .print (value , appendable , newRecord );
167167 newRecord = false ;
168168 }
169169
@@ -195,8 +195,8 @@ public void printComment(final String comment) throws IOException {
195195 if (!newRecord ) {
196196 println ();
197197 }
198- out .append (format .getCommentMarker ().charValue ());
199- out .append (SP );
198+ appendable .append (format .getCommentMarker ().charValue ());
199+ appendable .append (SP );
200200 for (int i = 0 ; i < comment .length (); i ++) {
201201 final char c = comment .charAt (i );
202202 switch (c ) {
@@ -207,11 +207,11 @@ public void printComment(final String comment) throws IOException {
207207 //$FALL-THROUGH$ break intentionally excluded.
208208 case LF :
209209 println ();
210- out .append (format .getCommentMarker ().charValue ());
211- out .append (SP );
210+ appendable .append (format .getCommentMarker ().charValue ());
211+ appendable .append (SP );
212212 break ;
213213 default :
214- out .append (c );
214+ appendable .append (c );
215215 break ;
216216 }
217217 }
@@ -237,7 +237,7 @@ public void printHeaders(final ResultSet resultSet) throws IOException, SQLExcep
237237 * If an I/O error occurs
238238 */
239239 public void println () throws IOException {
240- format .println (out );
240+ format .println (appendable );
241241 newRecord = true ;
242242 }
243243
0 commit comments