本文整理了Java中jodd.io.FileUtil.equals()
方法的一些代码示例,展示了FileUtil.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FileUtil.equals()
方法的具体详情如下:
包路径:jodd.io.FileUtil
类名称:FileUtil
方法名:equals
[英]Checks if two files points to the same file.
[中]检查两个文件是否指向同一个文件。
代码示例来源:origin: redisson/redisson
private static void checkDirCopy(File srcDir, File destDir) throws IOException {
if (!srcDir.exists()) {
throw new FileNotFoundException(MSG_NOT_FOUND + srcDir);
}
if (!srcDir.isDirectory()) {
throw new IOException(MSG_NOT_A_DIRECTORY + srcDir);
}
if (equals(srcDir, destDir)) {
throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are equal");
}
}
代码示例来源:origin: redisson/redisson
private static void checkFileCopy(File src, File dest, FileUtilParams params) throws IOException {
if (!src.exists()) {
throw new FileNotFoundException(MSG_NOT_FOUND + src);
}
if (!src.isFile()) {
throw new IOException(MSG_NOT_A_FILE + src);
}
if (equals(src, dest)) {
throw new IOException("Files '" + src + "' and '" + dest + "' are equal");
}
File destParent = dest.getParentFile();
if (destParent != null && !destParent.exists()) {
if (!params.createDirs) {
throw new IOException(MSG_NOT_FOUND + destParent);
}
if (!destParent.mkdirs()) {
throw new IOException(MSG_CANT_CREATE + destParent);
}
}
}
代码示例来源:origin: redisson/redisson
/**
* Checks if two files points to the same file.
*/
public static boolean equals(String file1, String file2) {
return equals(file(file1), file(file2));
}
代码示例来源:origin: oblac/jodd
/**
* Checks that srcDir exists, that it is a directory and if srcDir and destDir are not equal.
*
* @param srcDir Source directory
* @param destDir Destination directory
* @throws IOException if any of the above conditions are not true.
*/
private static void checkDirCopy(final File srcDir, final File destDir) throws IOException {
checkExists(srcDir);
checkIsDirectory(srcDir);
if (equals(srcDir, destDir)) {
throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are equal");
}
}
代码示例来源:origin: oblac/jodd
/**
* @see #equals(File, File)
*/
public static boolean equals(final String one, final String two) {
return equals(file(one), file(two));
}
代码示例来源:origin: redisson/redisson
if (equals(file1, file2)) {
return true;
代码示例来源:origin: oblac/jodd
/**
* Checks that file copy can occur.
*
* @param srcFile Source {@link File}
* @param destFile Destination {@link File}
* @throws IOException if srcFile does not exist or is not a file or
* srcFile and destFile are equal or cannot create ancestor directories.
*/
private static void checkFileCopy(final File srcFile, final File destFile) throws IOException {
checkExists(srcFile);
checkIsFile(srcFile);
if (equals(srcFile, destFile)) {
throw new IOException("Files '" + srcFile + "' and '" + destFile + "' are equal");
}
File destParent = destFile.getParentFile();
if (destParent != null && !destParent.exists()) {
checkCreateDirectory(destParent);
}
}
代码示例来源:origin: oblac/jodd
if (equals(one, two)) {
return true;
代码示例来源:origin: org.jodd/jodd-core
/**
* Checks that srcDir exists, that it is a directory and if srcDir and destDir are not equal.
*
* @param srcDir Source directory
* @param destDir Destination directory
* @throws IOException if any of the above conditions are not true.
*/
private static void checkDirCopy(final File srcDir, final File destDir) throws IOException {
checkExists(srcDir);
checkIsDirectory(srcDir);
if (equals(srcDir, destDir)) {
throw new IOException("Source '" + srcDir + "' and destination '" + destDir + "' are equal");
}
}
代码示例来源:origin: org.jodd/jodd-core
/**
* @see #equals(File, File)
*/
public static boolean equals(final String one, final String two) {
return equals(file(one), file(two));
}
代码示例来源:origin: org.jodd/jodd-core
/**
* Checks that file copy can occur.
*
* @param srcFile Source {@link File}
* @param destFile Destination {@link File}
* @throws IOException if srcFile does not exist or is not a file or
* srcFile and destFile are equal or cannot create ancestor directories.
*/
private static void checkFileCopy(final File srcFile, final File destFile) throws IOException {
checkExists(srcFile);
checkIsFile(srcFile);
if (equals(srcFile, destFile)) {
throw new IOException("Files '" + srcFile + "' and '" + destFile + "' are equal");
}
File destParent = destFile.getParentFile();
if (destParent != null && !destParent.exists()) {
checkCreateDirectory(destParent);
}
}
代码示例来源:origin: org.jodd/jodd-core
if (equals(one, two)) {
return true;
内容来源于网络,如有侵权,请联系作者删除!