本文整理了Java中org.apache.commons.io.FilenameUtils.equals()
方法的一些代码示例,展示了FilenameUtils.equals()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilenameUtils.equals()
方法的具体详情如下:
包路径:org.apache.commons.io.FilenameUtils
类名称:FilenameUtils
方法名:equals
[英]Checks whether two filenames are equal exactly.
No processing is performed on the filenames other than comparison, thus this is merely a null-safe case-sensitive equals.
[中]检查两个文件名是否完全相等。
除了比较之外,不会对文件名执行任何处理,因此这只是一个空安全的区分大小写的equals。
代码示例来源:origin: commons-io/commons-io
/**
* Checks whether two filenames are equal using the case rules of the system.
* <p>
* No processing is performed on the filenames other than comparison.
* The check is case-sensitive on Unix and case-insensitive on Windows.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SYSTEM
*/
public static boolean equalsOnSystem(final String filename1, final String filename2) {
return equals(filename1, filename2, false, IOCase.SYSTEM);
}
代码示例来源:origin: commons-io/commons-io
/**
* Checks whether two filenames are equal exactly.
* <p>
* No processing is performed on the filenames other than comparison,
* thus this is merely a null-safe case-sensitive equals.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SENSITIVE
*/
public static boolean equals(final String filename1, final String filename2) {
return equals(filename1, filename2, false, IOCase.SENSITIVE);
}
代码示例来源:origin: commons-io/commons-io
/**
* Checks whether two filenames are equal after both have been normalized.
* <p>
* Both filenames are first passed to {@link #normalize(String)}.
* The check is then performed in a case-sensitive manner.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SENSITIVE
*/
public static boolean equalsNormalized(final String filename1, final String filename2) {
return equals(filename1, filename2, true, IOCase.SENSITIVE);
}
代码示例来源:origin: commons-io/commons-io
/**
* Checks whether two filenames are equal after both have been normalized
* and using the case rules of the system.
* <p>
* Both filenames are first passed to {@link #normalize(String)}.
* The check is then performed case-sensitive on Unix and
* case-insensitive on Windows.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SYSTEM
*/
public static boolean equalsNormalizedOnSystem(final String filename1, final String filename2) {
return equals(filename1, filename2, true, IOCase.SYSTEM);
}
代码示例来源:origin: org.apache.commons/commons-io
/**
* Checks whether two filenames are equal exactly.
* <p>
* No processing is performed on the filenames other than comparison,
* thus this is merely a null-safe case-sensitive equals.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SENSITIVE
*/
public static boolean equals(String filename1, String filename2) {
return equals(filename1, filename2, false, IOCase.SENSITIVE);
}
代码示例来源:origin: org.apache.commons/commons-io
/**
* Checks whether two filenames are equal after both have been normalized.
* <p>
* Both filenames are first passed to {@link #normalize(String)}.
* The check is then performed in a case-sensitive manner.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SENSITIVE
*/
public static boolean equalsNormalized(String filename1, String filename2) {
return equals(filename1, filename2, true, IOCase.SENSITIVE);
}
代码示例来源:origin: org.apache.commons/commons-io
/**
* Checks whether two filenames are equal using the case rules of the system.
* <p>
* No processing is performed on the filenames other than comparison.
* The check is case-sensitive on Unix and case-insensitive on Windows.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SYSTEM
*/
public static boolean equalsOnSystem(String filename1, String filename2) {
return equals(filename1, filename2, false, IOCase.SYSTEM);
}
代码示例来源:origin: org.apache.commons/commons-io
/**
* Checks whether two filenames are equal after both have been normalized
* and using the case rules of the system.
* <p>
* Both filenames are first passed to {@link #normalize(String)}.
* The check is then performed case-sensitive on Unix and
* case-insensitive on Windows.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SYSTEM
*/
public static boolean equalsNormalizedOnSystem(String filename1, String filename2) {
return equals(filename1, filename2, true, IOCase.SYSTEM);
}
代码示例来源:origin: commons-io/commons-io
@Test
public void testEquals() {
assertTrue(FilenameUtils.equals(null, null));
assertFalse(FilenameUtils.equals(null, ""));
assertFalse(FilenameUtils.equals("", null));
assertTrue(FilenameUtils.equals("", ""));
assertTrue(FilenameUtils.equals("file.txt", "file.txt"));
assertFalse(FilenameUtils.equals("file.txt", "FILE.TXT"));
assertFalse(FilenameUtils.equals("a\\b\\file.txt", "a/b/file.txt"));
}
代码示例来源:origin: commons-io/commons-io
@Test
public void testEquals_fullControl() {
assertFalse(FilenameUtils.equals("file.txt", "FILE.TXT", true, IOCase.SENSITIVE));
assertTrue(FilenameUtils.equals("file.txt", "FILE.TXT", true, IOCase.INSENSITIVE));
assertEquals(WINDOWS, FilenameUtils.equals("file.txt", "FILE.TXT", true, IOCase.SYSTEM));
assertFalse(FilenameUtils.equals("file.txt", "FILE.TXT", true, null));
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.io
/**
* Checks whether two filenames are equal exactly.
* <p>
* No processing is performed on the filenames other than comparison,
* thus this is merely a null-safe case-sensitive equals.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SENSITIVE
*/
public static boolean equals(String filename1, String filename2) {
return equals(filename1, filename2, false, IOCase.SENSITIVE);
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.io
/**
* Checks whether two filenames are equal using the case rules of the system.
* <p>
* No processing is performed on the filenames other than comparison.
* The check is case-sensitive on Unix and case-insensitive on Windows.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SYSTEM
*/
public static boolean equalsOnSystem(String filename1, String filename2) {
return equals(filename1, filename2, false, IOCase.SYSTEM);
}
代码示例来源:origin: org.uberfire/vfs-model
/**
* Checks whether two filenames are equal exactly.
* <p>
* No processing is performed on the filenames other than comparison,
* thus this is merely a null-safe case-sensitive equals.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SENSITIVE
*/
public static boolean equals(String filename1, String filename2) {
return equals(filename1, filename2, false, IOCase.SENSITIVE);
}
代码示例来源:origin: Nextdoor/bender
/**
* Checks whether two filenames are equal using the case rules of the system.
* <p>
* No processing is performed on the filenames other than comparison.
* The check is case-sensitive on Unix and case-insensitive on Windows.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SYSTEM
*/
public static boolean equalsOnSystem(String filename1, String filename2) {
return equals(filename1, filename2, false, IOCase.SYSTEM);
}
代码示例来源:origin: org.apache.commons/com.springsource.org.apache.commons.io
/**
* Checks whether two filenames are equal after both have been normalized.
* <p>
* Both filenames are first passed to {@link #normalize(String)}.
* The check is then performed in a case-sensitive manner.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SENSITIVE
*/
public static boolean equalsNormalized(String filename1, String filename2) {
return equals(filename1, filename2, true, IOCase.SENSITIVE);
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-io
/**
* Checks whether two filenames are equal using the case rules of the system.
* <p>
* No processing is performed on the filenames other than comparison.
* The check is case-sensitive on Unix and case-insensitive on Windows.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SYSTEM
*/
public static boolean equalsOnSystem(String filename1, String filename2) {
return equals(filename1, filename2, false, IOCase.SYSTEM);
}
代码示例来源:origin: org.onosproject/onlab-thirdparty
/**
* Checks whether two filenames are equal after both have been normalized.
* <p>
* Both filenames are first passed to {@link #normalize(String)}.
* The check is then performed in a case-sensitive manner.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SENSITIVE
*/
public static boolean equalsNormalized(String filename1, String filename2) {
return equals(filename1, filename2, true, IOCase.SENSITIVE);
}
代码示例来源:origin: org.uberfire/vfs-model
/**
* Checks whether two filenames are equal after both have been normalized.
* <p>
* Both filenames are first passed to {@link #normalize(String)}.
* The check is then performed in a case-sensitive manner.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SENSITIVE
*/
public static boolean equalsNormalized(String filename1, String filename2) {
return equals(filename1, filename2, true, IOCase.SENSITIVE);
}
代码示例来源:origin: com.impetus.fabric/fabric-jdbc-driver-shaded
/**
* Checks whether two filenames are equal after both have been normalized.
* <p>
* Both filenames are first passed to {@link #normalize(String)}.
* The check is then performed in a case-sensitive manner.
*
* @param filename1 the first filename to query, may be null
* @param filename2 the second filename to query, may be null
* @return true if the filenames are equal, null equals null
* @see IOCase#SENSITIVE
*/
public static boolean equalsNormalized(final String filename1, final String filename2) {
return equals(filename1, filename2, true, IOCase.SENSITIVE);
}
代码示例来源:origin: kasonyang/kalang
public static boolean existFile(File srcFile) {
String absPath = srcFile.getAbsolutePath();
if (srcFile.exists()) {
String canonicalPath;
try {
canonicalPath = srcFile.getCanonicalPath();
} catch (IOException ex) {
return false;
}
return FilenameUtils.equals(canonicalPath, absPath, true, IOCase.SENSITIVE);
}
return false;
}
内容来源于网络,如有侵权,请联系作者删除!