How Can I Reset The File Pointer to the Beginning of the File in Java?

前端 未结 10 1325
孤城傲影
孤城傲影 2021-02-19 20:17

I am writing a program in Java that requires me to compare the data in 2 files. I have to check each line from file 1 against each line of file 2 and if I find a match write the

10条回答
  •  广开言路
    2021-02-19 21:07

    As others have suggested, you should consider other approaches to the problem. For the specific question of returning to a previous point in a file, java.io.FileReader inherits mark() and reset() methods that address this goal.

提交回复
热议问题