This is an automated email from the ASF dual-hosted git repository.

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-csv.git

commit 4f4b9cf2516762cd766368759c2c122f19f0caa5
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Thu Sep 19 16:04:47 2024 -0400

    Sort members
---
 .../apache/commons/csv/ExtendedBufferedReader.java | 56 +++++++++++-----------
 src/main/java/org/apache/commons/csv/Lexer.java    | 48 +++++++++----------
 2 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java 
b/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
index 82e16562..18c922a5 100644
--- a/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
+++ b/src/main/java/org/apache/commons/csv/ExtendedBufferedReader.java
@@ -56,22 +56,6 @@ final class ExtendedBufferedReader extends 
UnsynchronizedBufferedReader {
         super(reader);
     }
 
-    @Override
-    public void mark(final int readAheadLimit) throws IOException {
-        lineNumberMark = lineNumber;
-        lastCharMark = lastChar;
-        positionMark = position;
-        super.mark(readAheadLimit);
-    }
-
-    @Override
-    public void reset() throws IOException {
-        lineNumber = lineNumberMark;
-        lastChar = lastCharMark;
-        position = positionMark;
-        super.reset();
-    }
-
     /**
      * Closes the stream.
      *
@@ -85,6 +69,18 @@ final class ExtendedBufferedReader extends 
UnsynchronizedBufferedReader {
         super.close();
     }
 
+    /**
+     * Returns the last character that was read as an integer (0 to 65535). 
This will be the last character returned by
+     * any of the read methods. This will not include a character read using 
the {@link #peek()} method. If no
+     * character has been read then this will return {@link 
Constants#UNDEFINED}. If the end of the stream was reached
+     * on the last read then this will return {@link IOUtils#EOF}.
+     *
+     * @return the last character that was read
+     */
+    int getLastChar() {
+        return lastChar;
+    }
+
     /**
      * Returns the current line number
      *
@@ -98,18 +94,6 @@ final class ExtendedBufferedReader extends 
UnsynchronizedBufferedReader {
         return lineNumber + 1; // Allow for counter being incremented only at 
EOL
     }
 
-    /**
-     * Returns the last character that was read as an integer (0 to 65535). 
This will be the last character returned by
-     * any of the read methods. This will not include a character read using 
the {@link #peek()} method. If no
-     * character has been read then this will return {@link 
Constants#UNDEFINED}. If the end of the stream was reached
-     * on the last read then this will return {@link IOUtils#EOF}.
-     *
-     * @return the last character that was read
-     */
-    int getLastChar() {
-        return lastChar;
-    }
-
     /**
      * Gets the character position in the reader.
      *
@@ -119,6 +103,14 @@ final class ExtendedBufferedReader extends 
UnsynchronizedBufferedReader {
         return this.position;
     }
 
+    @Override
+    public void mark(final int readAheadLimit) throws IOException {
+        lineNumberMark = lineNumber;
+        lastCharMark = lastChar;
+        positionMark = position;
+        super.mark(readAheadLimit);
+    }
+
     @Override
     public int read() throws IOException {
         final int current = super.read();
@@ -190,4 +182,12 @@ final class ExtendedBufferedReader extends 
UnsynchronizedBufferedReader {
         return buffer.toString();
     }
 
+    @Override
+    public void reset() throws IOException {
+        lineNumber = lineNumberMark;
+        lastChar = lastCharMark;
+        position = positionMark;
+        super.reset();
+    }
+
 }
diff --git a/src/main/java/org/apache/commons/csv/Lexer.java 
b/src/main/java/org/apache/commons/csv/Lexer.java
index b25ade05..6d9c8a48 100644
--- a/src/main/java/org/apache/commons/csv/Lexer.java
+++ b/src/main/java/org/apache/commons/csv/Lexer.java
@@ -63,6 +63,26 @@ final class Lexer implements Closeable {
         this.escapeDelimiterBuf = new char[2 * delimiter.length - 1];
     }
 
+    /**
+     * Appends the next escaped character to the token's content.
+     *
+     * @param token the current token
+     * @throws IOException  on stream access error
+     * @throws CSVException Thrown on invalid input.
+     */
+    private void appendNextEscapedCharacterToToken(final Token token) throws 
IOException {
+        if (isEscapeDelimiter()) {
+            token.content.append(delimiter);
+        } else {
+            final int unescaped = readEscape();
+            if (unescaped == EOF) { // unexpected char after escape
+                token.content.append((char) escape).append((char) 
reader.getLastChar());
+            } else {
+                token.content.append((char) unescaped);
+            }
+        }
+    }
+
     /**
      * Closes resources.
      *
@@ -190,10 +210,6 @@ final class Lexer implements Closeable {
         return ch == Constants.LF || ch == Constants.CR || ch == 
Constants.UNDEFINED;
     }
 
-    private int nullToDisabled(final Character c) {
-        return c == null ? Constants.UNDEFINED : c.charValue(); // Explicit 
unboxing
-    }
-
     /**
      * Returns the next token.
      * <p>
@@ -279,6 +295,10 @@ final class Lexer implements Closeable {
         return token;
     }
 
+    private int nullToDisabled(final Character c) {
+        return c == null ? Constants.UNDEFINED : c.charValue(); // Explicit 
unboxing
+    }
+
     /**
      * Parses an encapsulated token.
      * <p>
@@ -408,26 +428,6 @@ final class Lexer implements Closeable {
         return token;
     }
 
-    /**
-     * Appends the next escaped character to the token's content.
-     *
-     * @param token the current token
-     * @throws IOException  on stream access error
-     * @throws CSVException Thrown on invalid input.
-     */
-    private void appendNextEscapedCharacterToToken(final Token token) throws 
IOException {
-        if (isEscapeDelimiter()) {
-            token.content.append(delimiter);
-        } else {
-            final int unescaped = readEscape();
-            if (unescaped == EOF) { // unexpected char after escape
-                token.content.append((char) escape).append((char) 
reader.getLastChar());
-            } else {
-                token.content.append((char) unescaped);
-            }
-        }
-    }
-
     /**
      * Greedily accepts \n, \r and \r\n This checker consumes silently the 
second control-character...
      *

Reply via email to