RFR(JDK11/NIO) 8202285: (fs) Add a method to Files for comparing file contents
huizhe.wang at oracle.com
Mon Apr 30 23:05:42 UTC 2018
On 4/27/2018 4:30 AM, Alan Bateman wrote:
> On 27/04/2018 05:51, Joe Wang wrote:
>> Considering extending isSameFile to add isSameContent to Files.
>> Please review.
>> JBS: https://bugs.openjdk.java.net/browse/JDK-8202285
>> webrev: http://cr.openjdk.java.net/~joehw/jdk11/8202285/webrev/
> I assume we should ignore the implementation for now as the eventual
> implementation won't use readAllBytes (at least not for for large files).
webrev was provided since sometimes it's helpful. But yeah, I've updated
> The existing isSameFile is specified as "Tests if two paths locate the
> same file" and it would be good if the new method could be somewhat
> consistent with that, e.g. "Tests if the content of two files is
> Specifying that two path that locate the same file always returns true
> is reasonable. This could be make clearer by say that the returning
> always returns true when path and path2 are equals, if event if the
> file does not exist.
Modified with a couple of bullet points, added the above to the first.
> The @return should say that it returns true if path and path2 locate
> the same file or the content of both files is identical.
> The javadoc for SecurityException has "to the file", I assume this
> should be "to both files".
More information about the core-libs-dev