Java: How to check that 2 binary files are same?

前端 未结 7 1301
旧时难觅i
旧时难觅i 2021-02-07 17:27

What is the easiest way to check (in a unit test) whether binary files A and B are equal?

7条回答
  •  不知归路
    2021-02-07 18:22

    Since Java 12 you could also use the Files.mismatch method JavaDoc. It will return -1L if the files are the same.

提交回复
热议问题