RFR(JDK12/NIO) 8202285: (fs) Add a method to Files for comparing file contents
Brian Burkhalter
brian.burkhalter at oracle.com
Thu Sep 20 15:10:50 UTC 2018
On Sep 19, 2018, at 5:59 PM, Joe Wang <huizhe.wang at oracle.com> wrote:
> I'll do some performance testing for both cases, FileChannel/direct buffer and possible checksum comparison, although, as you said, the later might not work since we need to be 100%. The probability of false positives is likely extremely low, but is not zero after all. I'll do the performance check any ways just out of curiosity. But in many cases, checksum comparison may not be faster than direct comparison, esp. in this case the API compares just two files. Checksum values would be nice if there are multiple files to compare.
I doubt the checksum test is worthwhile. It might be useful however to try FileChannel and direct byte buffers combined with ByteBuffer.mismatch() [1].
Thanks,
Brian
[1] https://download.java.net/java/early_access/jdk12/docs/api/java.base/java/nio/ByteBuffer.html#mismatch(java.nio.ByteBuffer)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20180920/81a2df91/attachment.html>
More information about the nio-dev
mailing list