Hisoka-X commented on code in PR #3038:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3038#discussion_r991088239


##########
seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/FileUtils.java:
##########
@@ -80,4 +84,77 @@ public static void createNewFile(String filePath) {
             createParentFile(file);
         }
     }
+
+    /**
+     * return the line number of file
+     *
+     * @param filePath The file need be read
+     * @return
+     */
+    public static Long getFileLineNumber(@NonNull String filePath) {
+        try (LineNumberReader lineNumberReader = new LineNumberReader(new 
FileReader(filePath))) {
+            lineNumberReader.skip(Long.MAX_VALUE);

Review Comment:
   Why we should skip some char?



##########
seatunnel-common/src/main/java/org/apache/seatunnel/common/utils/FileUtils.java:
##########
@@ -80,4 +84,77 @@ public static void createNewFile(String filePath) {
             createParentFile(file);
         }
     }
+
+    /**
+     * return the line number of file
+     *
+     * @param filePath The file need be read
+     * @return
+     */
+    public static Long getFileLineNumber(@NonNull String filePath) {
+        try (LineNumberReader lineNumberReader = new LineNumberReader(new 
FileReader(filePath))) {
+            lineNumberReader.skip(Long.MAX_VALUE);
+            long lineNumber = lineNumberReader.getLineNumber();
+            return lineNumber + 1;

Review Comment:
   Why should +1?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to