RFR(JDK12/NIO) 8202285: (fs) Add a method to Files for comparing file contents
Alan.Bateman at oracle.com
Thu Sep 20 07:07:40 UTC 2018
On 20/09/2018 01:34, Joe Wang wrote:
> The purpose of toRealPath is so that we can do a quick Path comparison
> by following symlinks if any, I'll add a test to compare a file and
> its symbolic link.
You don't need it. If two non-equals paths locate the same file then
mismatch will do the right thing. By dropping it then you avoid a
potentially expensive realpath (x2).
> ProviderMismatchExcepiton was added in one of the iterations when we
> defined UOE, shall be removed in the next update (I'll have an update
> after some performance work to compare with direct buffer is done).
> mismatchByAttrs cannot be replaced with isSameFile, it does one edge
> case check more than isSameFile when the size of one of the files is
> zero. mismatchByAttrs opens the files once vs twice if isSameFile and
> size(path) are called.
Hmm, I think we make this a lot simpler.
More information about the core-libs-dev