/** * Checks to see if the filename matches. * * @param dir the File directory (ignored) * @param name the filename * @return true if the filename matches */ @Override public boolean accept(final File dir, final String name) { for (final String name2 : names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param file the File to check * @return true if the filename matches */ @Override public boolean accept(final File file) { final String name = file.getName(); for (final String name2 : this.names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param file the File directory * @param name the filename * @return true if the filename matches */ public boolean accept(File file, String name) { for (int i = 0; i < names.length; i++) { if (caseSensitivity.checkEquals(name, names[i])) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param file the File to check * @return true if the filename matches */ public boolean accept(File file) { String name = file.getName(); for (int i = 0; i < this.names.length; i++) { if (caseSensitivity.checkEquals(name, names[i])) { return true; } } return false; }
if (IOCase.SYSTEM.checkEquals(canonicalParent, canonicalChild)) { return false;
/** * Checks whether two filenames are equal, optionally normalizing and providing * control over the case-sensitivity. * * @param filename1 the first filename to query, may be null * @param filename2 the second filename to query, may be null * @param normalized whether to normalize the filenames * @param caseSensitivity what case sensitivity rule to use, null means case-sensitive * @return true if the filenames are equal, null equals null * @since 1.3 */ public static boolean equals( String filename1, String filename2, final boolean normalized, IOCase caseSensitivity) { if (filename1 == null || filename2 == null) { return filename1 == null && filename2 == null; } if (normalized) { filename1 = normalize(filename1); filename2 = normalize(filename2); if (filename1 == null || filename2 == null) { throw new NullPointerException( "Error normalizing one or both of the file names"); } } if (caseSensitivity == null) { caseSensitivity = IOCase.SENSITIVE; } return caseSensitivity.checkEquals(filename1, filename2); }
@Test public void test_checkEquals_case() throws Exception { assertTrue(IOCase.SENSITIVE.checkEquals("ABC", "ABC")); assertFalse(IOCase.SENSITIVE.checkEquals("ABC", "Abc")); assertTrue(IOCase.INSENSITIVE.checkEquals("ABC", "ABC")); assertTrue(IOCase.INSENSITIVE.checkEquals("ABC", "Abc")); assertTrue(IOCase.SYSTEM.checkEquals("ABC", "ABC")); assertEquals(WINDOWS, IOCase.SYSTEM.checkEquals("ABC", "Abc")); }
@Test public void test_checkEquals_functionality() throws Exception { assertFalse(IOCase.SENSITIVE.checkEquals("ABC", "")); assertFalse(IOCase.SENSITIVE.checkEquals("ABC", "A")); assertFalse(IOCase.SENSITIVE.checkEquals("ABC", "AB")); assertTrue(IOCase.SENSITIVE.checkEquals("ABC", "ABC")); assertFalse(IOCase.SENSITIVE.checkEquals("ABC", "BC")); assertFalse(IOCase.SENSITIVE.checkEquals("ABC", "C")); assertFalse(IOCase.SENSITIVE.checkEquals("ABC", "ABCD")); assertFalse(IOCase.SENSITIVE.checkEquals("", "ABC")); assertTrue(IOCase.SENSITIVE.checkEquals("", "")); try { IOCase.SENSITIVE.checkEquals("ABC", null); fail(); } catch (final NullPointerException ignore) {} try { IOCase.SENSITIVE.checkEquals(null, "ABC"); fail(); } catch (final NullPointerException ignore) {} try { IOCase.SENSITIVE.checkEquals(null, null); fail(); } catch (final NullPointerException ignore) {} }
/** * Checks whether two filenames are equal, optionally normalizing and providing * control over the case-sensitivity. * * @param filename1 the first filename to query, may be null * @param filename2 the second filename to query, may be null * @param normalized whether to normalize the filenames * @param caseSensitivity what case sensitivity rule to use, null means case-sensitive * @return true if the filenames are equal, null equals null * @since Commons IO 1.3 */ public static boolean equals( String filename1, String filename2, boolean normalized, IOCase caseSensitivity) { if (filename1 == null || filename2 == null) { return filename1 == filename2; } if (normalized) { filename1 = normalize(filename1); filename2 = normalize(filename2); } if (caseSensitivity == null) { caseSensitivity = IOCase.SENSITIVE; } return caseSensitivity.checkEquals(filename1, filename2); }
/** * Checks to see if the filename matches. * * @param file the File directory * @param name the filename * @return true if the filename matches */ public boolean accept(File file, String name) { for (int i = 0; i < names.length; i++) { if (caseSensitivity.checkEquals(name, names[i])) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param file the File directory * @param name the filename * @return true if the filename matches */ public boolean accept(File file, String name) { for (int i = 0; i < names.length; i++) { if (caseSensitivity.checkEquals(name, names[i])) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param dir the File directory (ignored) * @param name the filename * @return true if the filename matches */ @Override public boolean accept(final File dir, final String name) { for (final String name2 : names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param dir the File directory (ignored) * @param name the filename * @return true if the filename matches */ @Override public boolean accept(final File dir, final String name) { for (final String name2 : names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param dir the File directory (ignored) * @param name the filename * @return true if the filename matches */ @Override public boolean accept(File dir, String name) { for (String name2 : names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param file the File to check * @return true if the filename matches */ @Override public boolean accept(final File file) { final String name = file.getName(); for (final String name2 : this.names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param file the File to check * @return true if the filename matches */ public boolean accept(File file) { String name = file.getName(); for (int i = 0; i < this.names.length; i++) { if (caseSensitivity.checkEquals(name, names[i])) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param file the File to check * @return true if the filename matches */ public boolean accept(File file) { String name = file.getName(); for (int i = 0; i < this.names.length; i++) { if (caseSensitivity.checkEquals(name, names[i])) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param file the File to check * @return true if the filename matches */ @Override public boolean accept(File file) { String name = file.getName(); for (String name2 : this.names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param file the File to check * @return true if the filename matches */ @Override public boolean accept(final File file) { final String name = file.getName(); for (final String name2 : this.names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }
/** * Checks to see if the filename matches. * * @param file the File to check * @return true if the filename matches */ @Override public boolean accept(File file) { String name = file.getName(); for (String name2 : this.names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }