Skip to content

Commit 4f4b9cf

Browse files
committed
Sort members
1 parent 6a11b89 commit 4f4b9cf

File tree

2 files changed

+52
-52
lines changed

2 files changed

+52
-52
lines changed

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

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -56,22 +56,6 @@ final class ExtendedBufferedReader extends UnsynchronizedBufferedReader {
5656
super(reader);
5757
}
5858

59-
@Override
60-
public void mark(final int readAheadLimit) throws IOException {
61-
lineNumberMark = lineNumber;
62-
lastCharMark = lastChar;
63-
positionMark = position;
64-
super.mark(readAheadLimit);
65-
}
66-
67-
@Override
68-
public void reset() throws IOException {
69-
lineNumber = lineNumberMark;
70-
lastChar = lastCharMark;
71-
position = positionMark;
72-
super.reset();
73-
}
74-
7559
/**
7660
* Closes the stream.
7761
*
@@ -85,6 +69,18 @@ public void close() throws IOException {
8569
super.close();
8670
}
8771

72+
/**
73+
* Returns the last character that was read as an integer (0 to 65535). This will be the last character returned by
74+
* any of the read methods. This will not include a character read using the {@link #peek()} method. If no
75+
* character has been read then this will return {@link Constants#UNDEFINED}. If the end of the stream was reached
76+
* on the last read then this will return {@link IOUtils#EOF}.
77+
*
78+
* @return the last character that was read
79+
*/
80+
int getLastChar() {
81+
return lastChar;
82+
}
83+
8884
/**
8985
* Returns the current line number
9086
*
@@ -98,18 +94,6 @@ long getLineNumber() {
9894
return lineNumber + 1; // Allow for counter being incremented only at EOL
9995
}
10096

101-
/**
102-
* Returns the last character that was read as an integer (0 to 65535). This will be the last character returned by
103-
* any of the read methods. This will not include a character read using the {@link #peek()} method. If no
104-
* character has been read then this will return {@link Constants#UNDEFINED}. If the end of the stream was reached
105-
* on the last read then this will return {@link IOUtils#EOF}.
106-
*
107-
* @return the last character that was read
108-
*/
109-
int getLastChar() {
110-
return lastChar;
111-
}
112-
11397
/**
11498
* Gets the character position in the reader.
11599
*
@@ -119,6 +103,14 @@ long getPosition() {
119103
return this.position;
120104
}
121105

106+
@Override
107+
public void mark(final int readAheadLimit) throws IOException {
108+
lineNumberMark = lineNumber;
109+
lastCharMark = lastChar;
110+
positionMark = position;
111+
super.mark(readAheadLimit);
112+
}
113+
122114
@Override
123115
public int read() throws IOException {
124116
final int current = super.read();
@@ -190,4 +182,12 @@ public String readLine() throws IOException {
190182
return buffer.toString();
191183
}
192184

185+
@Override
186+
public void reset() throws IOException {
187+
lineNumber = lineNumberMark;
188+
lastChar = lastCharMark;
189+
position = positionMark;
190+
super.reset();
191+
}
192+
193193
}

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

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,26 @@ final class Lexer implements Closeable {
6363
this.escapeDelimiterBuf = new char[2 * delimiter.length - 1];
6464
}
6565

66+
/**
67+
* Appends the next escaped character to the token's content.
68+
*
69+
* @param token the current token
70+
* @throws IOException on stream access error
71+
* @throws CSVException Thrown on invalid input.
72+
*/
73+
private void appendNextEscapedCharacterToToken(final Token token) throws IOException {
74+
if (isEscapeDelimiter()) {
75+
token.content.append(delimiter);
76+
} else {
77+
final int unescaped = readEscape();
78+
if (unescaped == EOF) { // unexpected char after escape
79+
token.content.append((char) escape).append((char) reader.getLastChar());
80+
} else {
81+
token.content.append((char) unescaped);
82+
}
83+
}
84+
}
85+
6686
/**
6787
* Closes resources.
6888
*
@@ -190,10 +210,6 @@ boolean isStartOfLine(final int ch) {
190210
return ch == Constants.LF || ch == Constants.CR || ch == Constants.UNDEFINED;
191211
}
192212

193-
private int nullToDisabled(final Character c) {
194-
return c == null ? Constants.UNDEFINED : c.charValue(); // Explicit unboxing
195-
}
196-
197213
/**
198214
* Returns the next token.
199215
* <p>
@@ -279,6 +295,10 @@ Token nextToken(final Token token) throws IOException {
279295
return token;
280296
}
281297

298+
private int nullToDisabled(final Character c) {
299+
return c == null ? Constants.UNDEFINED : c.charValue(); // Explicit unboxing
300+
}
301+
282302
/**
283303
* Parses an encapsulated token.
284304
* <p>
@@ -408,26 +428,6 @@ private Token parseSimpleToken(final Token token, int ch) throws IOException {
408428
return token;
409429
}
410430

411-
/**
412-
* Appends the next escaped character to the token's content.
413-
*
414-
* @param token the current token
415-
* @throws IOException on stream access error
416-
* @throws CSVException Thrown on invalid input.
417-
*/
418-
private void appendNextEscapedCharacterToToken(final Token token) throws IOException {
419-
if (isEscapeDelimiter()) {
420-
token.content.append(delimiter);
421-
} else {
422-
final int unescaped = readEscape();
423-
if (unescaped == EOF) { // unexpected char after escape
424-
token.content.append((char) escape).append((char) reader.getLastChar());
425-
} else {
426-
token.content.append((char) unescaped);
427-
}
428-
}
429-
}
430-
431431
/**
432432
* Greedily accepts \n, \r and \r\n This checker consumes silently the second control-character...
433433
*

0 commit comments

Comments
 (0)