@Override public boolean accept(File file, String name) { for (String suffix : this.suffixes) { if (caseSensitivity.checkEndsWith(name, suffix)) { return true; } } return false; }
@Override public boolean accept(File dir, String name) { for (String name2 : names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }
/** * Replaces the enumeration from the stream with a real one. * This ensures that the correct flag is set for SYSTEM. * * @return the resolved object */ private Object readResolve() { return forName(name); }
/** * Compare the names of two files with the specified case sensitivity. * * @param file1 The first file to compare * @param file2 The second file to compare * @return a negative value if the first file's name * is less than the second, zero if the names are the * same and a positive value if the first files name * is greater than the second file. */ public int compare(File file1, File file2) { return caseSensitivity.checkCompareTo(file1.getName(), file2.getName()); }
/** * Checks if one string contains another starting at a specific index using the * case-sensitivity rule. * <p> * This method mimics parts of {@link String#indexOf(String, int)} * but takes case-sensitivity into account. * * @param str the string to check, not null * @param strStartIndex the index to start at in str * @param search the start to search for, not null * @return the first index of the search String, * -1 if no match or {@code null} string input * @throws NullPointerException if either string is null * @since 2.0 */ public int checkIndexOf(String str, int strStartIndex, String search) { int endIndex = str.length() - search.length(); if (endIndex >= strStartIndex) { for (int i = strStartIndex; i <= endIndex; i++) { if (checkRegionMatches(str, i, search)) { return i; } } } return -1; }
@Override public boolean accept(File file) { String name = file.getName(); for (String suffix : this.suffixes) { if (caseSensitivity.checkEndsWith(name, suffix)) { return true; } } return false; }
@Override public boolean accept(File file) { String name = file.getName(); for (String name2 : this.names) { if (caseSensitivity.checkEquals(name, name2)) { return true; } } return false; }