in streampark-common/src/main/scala/org/apache/streampark/common/util/FileUtils.scala [118:143]
def equals(file1: File, file2: File): Boolean = {
(file1, file2) match {
case (a, b) if a == null || b == null => false
case (a, b) if !a.exists() || !b.exists() => false
case (a, b) if a.getAbsolutePath == b.getAbsolutePath => true
case (a, b) =>
val first = new BufferedInputStream(new FileInputStream(a))
val second = new BufferedInputStream(new FileInputStream(b))
if (first.available() != second.available()) false;
else {
while (true) {
val firRead = first.read()
val secRead = second.read()
if (firRead != secRead) {
Utils.close(first, second)
return false
}
if (firRead == -1) {
Utils.close(first, second)
return true;
}
}
true
}
}
}