You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2012/03/27 03:07:30 UTC
svn commit: r1305700 -
/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
Author: sebb
Date: Tue Mar 27 01:07:30 2012
New Revision: 1305700
URL: http://svn.apache.org/viewvc?rev=1305700&view=rev
Log:
Calculate the booleans once; prepares for CSV-78
Modified:
commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
Modified: commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java
URL: http://svn.apache.org/viewvc/commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java?rev=1305700&r1=1305699&r2=1305700&view=diff
==============================================================================
--- commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java (original)
+++ commons/proper/csv/trunk/src/main/java/org/apache/commons/csv/CSVFormat.java Tue Mar 27 01:07:30 2012
@@ -41,6 +41,9 @@ public class CSVFormat implements Serial
private final String lineSeparator; // for outputs
private final String[] header;
+ private final boolean isEscaping;
+ private final boolean isCommentingEnabled;
+ private final boolean isEncapsulating;
/**
* Constant char to be used for disabling comments, escapes and encapsulation.
@@ -156,6 +159,9 @@ public class CSVFormat implements Serial
this.emptyLinesIgnored = emptyLinesIgnored;
this.lineSeparator = lineSeparator;
this.header = header;
+ this.isEncapsulating = encapsulator != DISABLED;
+ this.isCommentingEnabled = commentStart != DISABLED;
+ this.isEscaping = escape != DISABLED;
}
/**
@@ -243,7 +249,7 @@ public class CSVFormat implements Serial
}
boolean isEncapsulating() {
- return this.encapsulator != DISABLED;
+ return isEncapsulating;
}
/**
@@ -276,7 +282,7 @@ public class CSVFormat implements Serial
* @return <tt>true</tt> is comments are supported, <tt>false</tt> otherwise
*/
public boolean isCommentingEnabled() {
- return this.commentStart != DISABLED;
+ return isCommentingEnabled;
}
/**
@@ -304,7 +310,7 @@ public class CSVFormat implements Serial
}
boolean isEscaping() {
- return this.escape != DISABLED;
+ return isEscaping;
}
/**