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

前端 未结 7 1306
旧时难觅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:15

    Are third-party libraries fair game? Guava has Files.equal(File, File). There's no real reason to bother with hashing if you don't have to; it can only be less efficient.

提交回复
热议问题