Skip to content

Commit 350d34d

Browse files
committed
Rename encapsulator to quote char.
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1398187 13f79535-47bb-0310-9956-ffa450edef68
1 parent ddfe9df commit 350d34d

11 files changed

Lines changed: 20 additions & 20 deletions

File tree

src/main/java/org/apache/commons/csv/CSVLexer.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Token nextToken(final Token token) throws IOException {
110110
// empty token return EORECORD("")
111111
// noop: tkn.content.append("");
112112
token.type = EORECORD;
113-
} else if (isEncapsulator(c)) {
113+
} else if (isQuoteChar(c)) {
114114
// consume encapsulated token
115115
encapsulatedTokenLexer(token);
116116
} else if (isEndOfFile(c)) {
@@ -204,8 +204,8 @@ private Token encapsulatedTokenLexer(final Token tkn) throws IOException {
204204

205205
if (isEscape(c)) {
206206
tkn.content.append((char) readEscape());
207-
} else if (isEncapsulator(c)) {
208-
if (isEncapsulator(in.lookAhead())) {
207+
} else if (isQuoteChar(c)) {
208+
if (isQuoteChar(in.lookAhead())) {
209209
// double or escaped encapsulator -> add single encapsulator to token
210210
c = in.read();
211211
tkn.content.append((char) c);

src/main/java/org/apache/commons/csv/Lexer.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ abstract class Lexer {
4343

4444
private final char delimiter;
4545
private final char escape;
46-
private final char encapsulator;
46+
private final char quoteChar;
4747
private final char commmentStart;
4848

4949
final boolean ignoreSurroundingSpaces;
@@ -59,7 +59,7 @@ abstract class Lexer {
5959
this.in = in;
6060
this.delimiter = format.getDelimiter();
6161
this.escape = mapNullToDisabled(format.getEscape());
62-
this.encapsulator = mapNullToDisabled(format.getQuoteChar());
62+
this.quoteChar = mapNullToDisabled(format.getQuoteChar());
6363
this.commmentStart = mapNullToDisabled(format.getCommentStart());
6464
this.ignoreSurroundingSpaces = format.getIgnoreSurroundingSpaces();
6565
this.ignoreEmptyLines = format.getIgnoreEmptyLines();
@@ -153,8 +153,8 @@ boolean isEscape(final int c) {
153153
return c == escape;
154154
}
155155

156-
boolean isEncapsulator(final int c) {
157-
return c == encapsulator;
156+
boolean isQuoteChar(final int c) {
157+
return c == quoteChar;
158158
}
159159

160160
boolean isCommentStart(final int c) {

src/test/java/org/apache/commons/csv/CSVLexer1306663.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Token nextToken(final Token tkn) throws IOException {
110110
// empty token return EORECORD("")
111111
//noop: tkn.content.append("");
112112
tkn.type = EORECORD;
113-
} else if (isEncapsulator(c)) {
113+
} else if (isQuoteChar(c)) {
114114
// consume encapsulated token
115115
encapsulatedTokenLexer(tkn);
116116
} else if (isEndOfFile(c)) {
@@ -196,8 +196,8 @@ private Token encapsulatedTokenLexer(final Token tkn) throws IOException {
196196

197197
if (isEscape(c)) {
198198
tkn.content.append((char) readEscape());
199-
} else if (isEncapsulator(c)) {
200-
if (isEncapsulator(in.lookAhead())) {
199+
} else if (isQuoteChar(c)) {
200+
if (isQuoteChar(in.lookAhead())) {
201201
// double or escaped encapsulator -> add single encapsulator to token
202202
c = in.read();
203203
tkn.content.append((char) c);

src/test/java/org/apache/commons/csv/CSVLexer1306667.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ Token nextToken(final Token tkn) throws IOException {
110110
// empty token return EORECORD("")
111111
//noop: tkn.content.append("");
112112
tkn.type = EORECORD;
113-
} else if (isEncapsulator(c)) {
113+
} else if (isQuoteChar(c)) {
114114
// consume encapsulated token
115115
encapsulatedTokenLexer(tkn);
116116
} else if (isEndOfFile(c)) {
@@ -196,8 +196,8 @@ private Token encapsulatedTokenLexer(final Token tkn) throws IOException {
196196

197197
if (isEscape(c)) {
198198
tkn.content.append((char) readEscape());
199-
} else if (isEncapsulator(c)) {
200-
if (isEncapsulator(in.lookAhead())) {
199+
} else if (isQuoteChar(c)) {
200+
if (isQuoteChar(in.lookAhead())) {
201201
// double or escaped encapsulator -> add single encapsulator to token
202202
c = in.read();
203203
tkn.content.append((char) c);

src/test/java/org/apache/commons/csv/CSVLexer3.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private CharType classify(final int intch) {
6464
if (isCommentStart(intch)) {
6565
return CharType.COMMENT_START;
6666
}
67-
if (isEncapsulator(intch)) {
67+
if (isQuoteChar(intch)) {
6868
return CharType.ENCAP;
6969
}
7070
if (isEscape(intch)) {

src/test/resources/CSVFileParser/testCSV85_default.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
testCSV85.csv CommentStart=# CheckComments
2-
Delimiter=<,> Encapsulator=<"> CommentStart=<#>
2+
Delimiter=<,> QuoteChar=<"> CommentStart=<#>
33
# Comment 1
44
5:[a, b, c, e, f]#Comment 1
55
# Very Long

src/test/resources/CSVFileParser/testCSV85_ignoreEmpty.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
testCSV85.csv CommentStart=# IgnoreEmpty=true CheckComments
2-
Delimiter=<,> Encapsulator=<"> CommentStart=<#> EmptyLines:ignored
2+
Delimiter=<,> QuoteChar=<"> CommentStart=<#> EmptyLines:ignored
33
# Comment 1
44
5:[a, b, c, e, f]#Comment 1
55
# Very Long

src/test/resources/CSVFileParser/test_default.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test.csv IgnoreEmpty=true
2-
Delimiter=<,> Encapsulator=<"> EmptyLines:ignored
2+
Delimiter=<,> QuoteChar=<"> EmptyLines:ignored
33
4:[A, B, C, D]
44
1:[# plain values]
55
4:[a, b, c, d]

src/test/resources/CSVFileParser/test_default_comment.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test.csv IgnoreEmpty=true CommentStart=#
2-
Delimiter=<,> Encapsulator=<"> CommentStart=<#> EmptyLines:ignored
2+
Delimiter=<,> QuoteChar=<"> CommentStart=<#> EmptyLines:ignored
33
4:[A, B, C, D]
44
4:[a, b, c, d]
55
4:[ e , f , g, h ]

src/test/resources/CSVFileParser/test_rfc4180.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test.csv
2-
Delimiter=<,> Encapsulator=<">
2+
Delimiter=<,> QuoteChar=<">
33
4:[A, B, C, D]
44
1:[# plain values]
55
4:[a, b, c, d]

0 commit comments

Comments
 (0)