Read the last line of the csv file

We have a number of csv files. Below is one of them:

CODE,DT,OP,CL
600038,2023-06-02,4.39,4.5
603818,2023-06-02,215.93,235
…
600788,2023-06-30,101.46,110.6
350880,2023-06-30,56.59,60.09
CODE,DT,OP,CL
600038,2023-06-02,4.39,4.5
603818,2023-06-02,215.93,235

600788,2023-06-30,101.46,110.6
350880,2023-06-30,56.59,60.09
Use Java to do the task: Use file name as the parameter and read the last line of the csv file.
Here is the SPL code:

=file(?).read@n().m(-1)

read@n()function reads each text file line by line. m(-1) function gets the last member of a sequence.

Read How to Call a SPL Script in Java to find how to integrate SPL into a Java application.

Source:https://stackoverflow.com/questions/73811082/how-do-i-read-only-the-last-line-of-a-csv-file-in-java