@@ -41,6 +41,9 @@ public class CSVFormat implements Serializable {
4141 private final String lineSeparator ; // for outputs
4242 private final String [] header ;
4343
44+ private final boolean isEscaping ;
45+ private final boolean isCommentingEnabled ;
46+ private final boolean isEncapsulating ;
4447
4548 /**
4649 * Constant char to be used for disabling comments, escapes and encapsulation.
@@ -156,6 +159,9 @@ public class CSVFormat implements Serializable {
156159 this .emptyLinesIgnored = emptyLinesIgnored ;
157160 this .lineSeparator = lineSeparator ;
158161 this .header = header ;
162+ this .isEncapsulating = encapsulator != DISABLED ;
163+ this .isCommentingEnabled = commentStart != DISABLED ;
164+ this .isEscaping = escape != DISABLED ;
159165 }
160166
161167 /**
@@ -243,7 +249,7 @@ public CSVFormat withEncapsulator(char encapsulator) {
243249 }
244250
245251 boolean isEncapsulating () {
246- return this . encapsulator != DISABLED ;
252+ return isEncapsulating ;
247253 }
248254
249255 /**
@@ -276,7 +282,7 @@ public CSVFormat withCommentStart(char commentStart) {
276282 * @return <tt>true</tt> is comments are supported, <tt>false</tt> otherwise
277283 */
278284 public boolean isCommentingEnabled () {
279- return this . commentStart != DISABLED ;
285+ return isCommentingEnabled ;
280286 }
281287
282288 /**
@@ -304,7 +310,7 @@ public CSVFormat withEscape(char escape) {
304310 }
305311
306312 boolean isEscaping () {
307- return this . escape != DISABLED ;
313+ return isEscaping ;
308314 }
309315
310316 /**
0 commit comments