@@ -40,14 +40,14 @@ public class CSVFormat implements Serializable {
4040 private static final long serialVersionUID = 1L ;
4141
4242 private final char delimiter ;
43- private final Character encapsulator ;
43+ private final Character quoteChar ;
44+ private final Quote quotePolicy ;
4445 private final Character commentStart ;
4546 private final Character escape ;
4647 private final boolean ignoreSurroundingSpaces ; // Should leading/trailing spaces be ignored around values?
4748 private final boolean ignoreEmptyLines ;
4849 private final String lineSeparator ; // for outputs
4950 private final String [] header ;
50- private final Quote quotePolicy ;
5151
5252 /**
5353 * Starting format; used for creating other formats.
@@ -129,7 +129,7 @@ public class CSVFormat implements Serializable {
129129 *
130130 * @param delimiter
131131 * the char used for value separation
132- * @param encapsulator
132+ * @param quoteChar
133133 * the char used as value encapsulation marker
134134 * @param quotePolicy
135135 * the quote policy
@@ -150,7 +150,7 @@ public CSVFormat(final char delimiter, final Character encapsulator, final Quote
150150 boolean ignoreSurroundingSpaces , final boolean ignoreEmptyLines , final String lineSeparator ,
151151 final String [] header ) {
152152 this .delimiter = delimiter ;
153- this .encapsulator = encapsulator ;
153+ this .quoteChar = encapsulator ;
154154 this .quotePolicy = quotePolicy ;
155155 this .commentStart = commentStart ;
156156 this .escape = escape ;
@@ -178,8 +178,8 @@ private static boolean isLineBreak(final Character c) {
178178 * @throws IllegalStateException
179179 */
180180 void validate () throws IllegalStateException {
181- if (encapsulator != null && delimiter == encapsulator ) {
182- throw new IllegalStateException ("The encapsulator character and the delimiter cannot be the same ('" + encapsulator + "')" );
181+ if (quoteChar != null && delimiter == quoteChar ) {
182+ throw new IllegalStateException ("The quoteChar character and the delimiter cannot be the same ('" + quoteChar + "')" );
183183 }
184184
185185 if (escape != null && delimiter == escape ) {
@@ -191,8 +191,8 @@ void validate() throws IllegalStateException {
191191 "')" );
192192 }
193193
194- if (encapsulator != null && encapsulator == commentStart ) {
195- throw new IllegalStateException ("The comment start character and the encapsulator cannot be the same ('" + commentStart +
194+ if (quoteChar != null && quoteChar == commentStart ) {
195+ throw new IllegalStateException ("The comment start character and the quoteChar cannot be the same ('" + commentStart +
196196 "')" );
197197 }
198198
@@ -236,25 +236,25 @@ public CSVFormat withDelimiter(final Character delimiter) {
236236 if (isLineBreak (delimiter )) {
237237 throw new IllegalArgumentException ("The delimiter cannot be a line break" );
238238 }
239- return new CSVFormat (delimiter , encapsulator , quotePolicy , commentStart , escape ,
239+ return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
240240 ignoreSurroundingSpaces , ignoreEmptyLines , lineSeparator , header );
241241 }
242242
243243 /**
244244 * Returns the character used to encapsulate values containing special characters.
245245 *
246- * @return the encapsulator character
246+ * @return the quoteChar character
247247 */
248- public Character getEncapsulator () {
249- return encapsulator ;
248+ public Character getQuoteChar () {
249+ return quoteChar ;
250250 }
251251
252252 /**
253- * Returns a copy of this format using the specified encapsulator character.
253+ * Returns a copy of this format using the specified quoteChar character.
254254 *
255- * @param encapsulator
256- * the encapsulator character
257- * @return A copy of this format using the specified encapsulator character
255+ * @param quoteChar
256+ * the quoteChar character
257+ * @return A copy of this format using the specified quoteChar character
258258 * @throws IllegalArgumentException
259259 * thrown if the specified character is a line break
260260 */
@@ -263,29 +263,29 @@ public CSVFormat withEncapsulator(final char encapsulator) {
263263 }
264264
265265 /**
266- * Returns a copy of this format using the specified encapsulator character.
266+ * Returns a copy of this format using the specified quoteChar character.
267267 *
268- * @param encapsulator
269- * the encapsulator character
270- * @return A copy of this format using the specified encapsulator character
268+ * @param quoteChar
269+ * the quoteChar character
270+ * @return A copy of this format using the specified quoteChar character
271271 * @throws IllegalArgumentException
272272 * thrown if the specified character is a line break
273273 */
274274 public CSVFormat withEncapsulator (final Character encapsulator ) {
275275 if (isLineBreak (encapsulator )) {
276- throw new IllegalArgumentException ("The encapsulator cannot be a line break" );
276+ throw new IllegalArgumentException ("The quoteChar cannot be a line break" );
277277 }
278278 return new CSVFormat (delimiter , encapsulator , quotePolicy , commentStart , escape ,
279279 ignoreSurroundingSpaces , ignoreEmptyLines , lineSeparator , header );
280280 }
281281
282282 /**
283- * Returns whether an encapsulator has been defined.
283+ * Returns whether an quoteChar has been defined.
284284 *
285- * @return {@code true} if an encapsulator is defined
285+ * @return {@code true} if an quoteChar is defined
286286 */
287287 public boolean isEncapsulating () {
288- return encapsulator != null ;
288+ return quoteChar != null ;
289289 }
290290
291291 /**
@@ -327,7 +327,7 @@ public CSVFormat withCommentStart(final Character commentStart) {
327327 if (isLineBreak (commentStart )) {
328328 throw new IllegalArgumentException ("The comment start character cannot be a line break" );
329329 }
330- return new CSVFormat (delimiter , encapsulator , quotePolicy , commentStart , escape ,
330+ return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
331331 ignoreSurroundingSpaces , ignoreEmptyLines , lineSeparator , header );
332332 }
333333
@@ -377,7 +377,7 @@ public CSVFormat withEscape(final Character escape) {
377377 if (isLineBreak (escape )) {
378378 throw new IllegalArgumentException ("The escape character cannot be a line break" );
379379 }
380- return new CSVFormat (delimiter , encapsulator , quotePolicy , commentStart , escape ,
380+ return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
381381 ignoreSurroundingSpaces , ignoreEmptyLines , lineSeparator , header );
382382 }
383383
@@ -409,7 +409,7 @@ public boolean getIgnoreSurroundingSpaces() {
409409 * @return A copy of this format with the specified trimming behavior.
410410 */
411411 public CSVFormat withIgnoreSurroundingSpaces (final boolean ignoreSurroundingSpaces ) {
412- return new CSVFormat (delimiter , encapsulator , quotePolicy , commentStart , escape ,
412+ return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
413413 ignoreSurroundingSpaces , ignoreEmptyLines , lineSeparator , header );
414414 }
415415
@@ -432,7 +432,7 @@ public boolean getIgnoreEmptyLines() {
432432 * @return A copy of this format with the specified empty line skipping behavior.
433433 */
434434 public CSVFormat withIgnoreEmptyLines (final boolean ignoreEmptyLines ) {
435- return new CSVFormat (delimiter , encapsulator , quotePolicy , commentStart , escape ,
435+ return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
436436 ignoreSurroundingSpaces , ignoreEmptyLines , lineSeparator , header );
437437 }
438438
@@ -454,7 +454,7 @@ public String getLineSeparator() {
454454 * @return A copy of this format using the specified output line separator
455455 */
456456 public CSVFormat withLineSeparator (final char lineSeparator ) {
457- return new CSVFormat (delimiter , encapsulator , quotePolicy , commentStart , escape ,
457+ return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
458458 ignoreSurroundingSpaces , ignoreEmptyLines , String .valueOf (lineSeparator ), header );
459459 }
460460
@@ -467,7 +467,7 @@ public CSVFormat withLineSeparator(final char lineSeparator) {
467467 * @return A copy of this format using the specified output line separator
468468 */
469469 public CSVFormat withLineSeparator (final String lineSeparator ) {
470- return new CSVFormat (delimiter , encapsulator , quotePolicy , commentStart , escape ,
470+ return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
471471 ignoreSurroundingSpaces , ignoreEmptyLines , lineSeparator , header );
472472 }
473473
@@ -480,7 +480,7 @@ public CSVFormat withLineSeparator(final String lineSeparator) {
480480 * @return A copy of this format using the specified output line separator
481481 */
482482 public CSVFormat withQuotePolicy (final Quote quotePolicy ) {
483- return new CSVFormat (delimiter , encapsulator , quotePolicy , commentStart , escape ,
483+ return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
484484 ignoreSurroundingSpaces , ignoreEmptyLines , lineSeparator , header );
485485 }
486486
@@ -508,7 +508,7 @@ String[] getHeader() {
508508 * @return A copy of this format using the specified header
509509 */
510510 public CSVFormat withHeader (final String ... header ) {
511- return new CSVFormat (delimiter , encapsulator , quotePolicy , commentStart , escape ,
511+ return new CSVFormat (delimiter , quoteChar , quotePolicy , commentStart , escape ,
512512 ignoreSurroundingSpaces , ignoreEmptyLines , lineSeparator , header );
513513 }
514514
@@ -549,7 +549,7 @@ public String toString() {
549549 }
550550 if (isEncapsulating ()) {
551551 sb .append (' ' );
552- sb .append ("Encapsulator=<" ).append (encapsulator ).append ('>' );
552+ sb .append ("Encapsulator=<" ).append (quoteChar ).append ('>' );
553553 }
554554 if (isCommentingEnabled ()) {
555555 sb .append (' ' );
0 commit comments