EricJoy2048 commented on code in PR #3038:
URL: 
https://github.com/apache/incubator-seatunnel/pull/3038#discussion_r991146012


##########
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:
   > 
   
   I will use replace LineNumberReader, because if the file content chars more 
than Long.MAX_VALUE, it will error.
   
   ```
   try {
           return Files.lines(Paths.get(filePath)).count();
       } catch (IOException e) {
           return -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