Package Summary  Overview Summary

method:isSameContent(java.nio.file.Path, java.nio.file.Path) [ADDED]

  • isSameContent

    public static boolean isSameContent​(Path path,
                                        Path path2)
                                 throws IOException
    
    Tests if the content of two files is identical. This method extends the isSameFile method to further compare the content of the two files.

    It always returns true when path and path2:

    If isSameFile(path, path2) returns false, this method will proceed to read the files and compare them byte by byte to determine if they contain the same content. It is assumed that the two files remain static during the comparison process.

    Parameters:
    path - the path to a file
    path2 - the path to another file
    Returns:
    a boolean indicating whether path and path2 locate the same file or their contents are identical.
    Throws:
    IOException - if an I/O error occurs
    java.lang.SecurityException - In the case of the default provider, and a security manager is installed, the checkRead method is invoked to check read access to both files.
    Since:
    11