1
0
mirror of https://github.com/mitb-archive/filebot synced 2024-12-23 08:18:52 -05:00

equalsFileContent

This commit is contained in:
Reinhard Pointner 2017-04-16 00:40:58 +08:00
parent a442f32ae3
commit 6b4e5bfbe0

View File

@ -274,6 +274,27 @@ public final class FileUtilities {
return a.getPath().equals(b.getPath());
}
public static boolean equalsFileContent(File a, File b) {
// must have the same file size
if (a.length() != b.length()) {
return false;
}
// must not be a folder
if (a.isDirectory() || b.isDirectory()) {
return false;
}
// must be equal byte by byte
try {
return FileUtils.contentEquals(a, b);
} catch (Exception e) {
log.warning(cause(e));
}
return false;
}
/**
* Pattern used for matching file extensions.
*