Skip to content

Commit e5fa9c9

Browse files
committed
Use the same internal name as LineNumberReader
1 parent 5c73cdc commit e5fa9c9

1 file changed

Lines changed: 7 additions & 7 deletions

File tree

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

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ final class ExtendedBufferedReader extends BufferedReader {
4141
private int lastChar = UNDEFINED;
4242

4343
/** The count of EOLs (CR/LF/CRLF) seen so far */
44-
private long eolCounter;
44+
private long lineNumber;
4545

4646
/** The position, which is the number of characters read so far */
4747
private long position;
@@ -77,9 +77,9 @@ public void close() throws IOException {
7777
long getCurrentLineNumber() {
7878
// Check if we are at EOL or EOF or just starting
7979
if (lastChar == CR || lastChar == LF || lastChar == UNDEFINED || lastChar == EOF) {
80-
return eolCounter; // counter is accurate
80+
return lineNumber; // counter is accurate
8181
}
82-
return eolCounter + 1; // Allow for counter being incremented only at EOL
82+
return lineNumber + 1; // Allow for counter being incremented only at EOL
8383
}
8484

8585
/**
@@ -144,7 +144,7 @@ public int read() throws IOException {
144144
final int current = super.read();
145145
if (current == CR || current == LF && lastChar != CR ||
146146
current == EOF && lastChar != CR && lastChar != LF && lastChar != EOF) {
147-
eolCounter++;
147+
lineNumber++;
148148
}
149149
lastChar = current;
150150
position++;
@@ -162,10 +162,10 @@ public int read(final char[] buf, final int offset, final int length) throws IOE
162162
final char ch = buf[i];
163163
if (ch == LF) {
164164
if (CR != (i > offset ? buf[i - 1] : lastChar)) {
165-
eolCounter++;
165+
lineNumber++;
166166
}
167167
} else if (ch == CR) {
168-
eolCounter++;
168+
lineNumber++;
169169
}
170170
}
171171
lastChar = buf[offset + len - 1];
@@ -180,7 +180,7 @@ public int read(final char[] buf, final int offset, final int length) throws IOE
180180
* Gets the next line, dropping the line terminator(s). This method should only be called when processing a
181181
* comment, otherwise, information can be lost.
182182
* <p>
183-
* Increments {@link #eolCounter} and updates {@link #position}.
183+
* Increments {@link #lineNumber} and updates {@link #position}.
184184
* </p>
185185
* <p>
186186
* Sets {@link #lastChar} to {@code Constants.EOF} at EOF, otherwise the last EOL character.

0 commit comments

Comments
 (0)