Files mismatch работает в eclipse, не работает в repl.it
Есть метод для сравнения содержимого двух файлов, в eclipse всё корректно работает, а в repl.it ошибка, как исправить?
public static void equal() throws IOException {
Scanner sc = new Scanner(System.in);
System.out.println("first file name: ");
String firstFile = sc.nextLine();
File firstFileSize = new File(firstFile);
if (!firstFileSize.exists()) {
System.out.println("Does not exist");
return;
}
System.out.println("second file name: ");
String secondFile = sc.nextLine();
File secondFileSize = new File(secondFile);
if (!secondFileSize.exists()) {
System.out.println("Does not exist");
return;
}
Path pathFirstFile = Paths.get(firstFile);
Path pathSecondFile = Paths.get(secondFile);
if (sameContent(pathFirstFile, pathSecondFile) == true) {
System.out.println("true");
} else {
System.out.println("false");
}
}
private static boolean sameContent(Path file1, Path file2) throws IOException {
return Files.mismatch(file1, file2) == -1;
}
