Java Code Examples for org.apache.commons.io.IOCase#SENSITIVE

The following examples show how to use org.apache.commons.io.IOCase#SENSITIVE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FilenameUtils.java    From iaf with Apache License 2.0 6 votes vote down vote up
/**
 * 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 == 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);
}
 
Example 2
Source File: NameFileFilter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Constructs a new name file filter for an array of names specifying case-sensitivity.
 *
 * @param names  the names to allow, must not be null
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the names array is null
 */
public NameFileFilter(final String[] names, final IOCase caseSensitivity) {
    if (names == null) {
        throw new IllegalArgumentException("The array of names must not be null");
    }
    this.names = new String[names.length];
    System.arraycopy(names, 0, this.names, 0, names.length);
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 3
Source File: WildcardFileFilter.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Construct a new wildcard filter for a single wildcard specifying case-sensitivity.
 *
 * @param wildcard  the wildcard to match, not null
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the pattern is null
 */
public WildcardFileFilter(final String wildcard, final IOCase caseSensitivity) {
    if (wildcard == null) {
        throw new IllegalArgumentException("The wildcard must not be null");
    }
    this.wildcards = new String[] { wildcard };
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 4
Source File: PathFileComparator.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Construct a case sensitive file path comparator instance.
 */
public PathFileComparator() {
    this.caseSensitivity = IOCase.SENSITIVE;
}
 
Example 5
Source File: WildcardFileFilter.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Construct a new wildcard filter for a list of wildcards specifying case-sensitivity.
 *
 * @param wildcards  the list of wildcards to match, not null
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the pattern list is null
 * @throws ClassCastException if the list does not contain Strings
 */
public WildcardFileFilter(final List<String> wildcards, final IOCase caseSensitivity) {
    if (wildcards == null) {
        throw new IllegalArgumentException("The wildcard list must not be null");
    }
    this.wildcards = wildcards.toArray(new String[wildcards.size()]);
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 6
Source File: SuffixFileFilter.java    From lams with GNU General Public License v2.0 3 votes vote down vote up
/**
 * Constructs a new Suffix file filter for a single extension
 * specifying case-sensitivity.
 *
 * @param suffix  the suffix to allow, must not be null
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the suffix is null
 * @since 1.4
 */
public SuffixFileFilter(final String suffix, final IOCase caseSensitivity) {
    if (suffix == null) {
        throw new IllegalArgumentException("The suffix must not be null");
    }
    this.suffixes = new String[] {suffix};
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 7
Source File: PrefixFileFilter.java    From aion-germany with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Constructs a new Prefix file filter for any of an array of prefixes
 * specifying case-sensitivity.
 * <p>
 * The array is not cloned, so could be changed after constructing the
 * instance. This would be inadvisable however.
 * 
 * @param prefixes  the prefixes to allow, must not be null
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the prefix is null
 * @since 1.4
 */
public PrefixFileFilter(String[] prefixes, IOCase caseSensitivity) {
    if (prefixes == null) {
        throw new IllegalArgumentException("The array of prefixes must not be null");
    }
    this.prefixes = new String[prefixes.length];
    System.arraycopy(prefixes, 0, this.prefixes, 0, prefixes.length);
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 8
Source File: SuffixFileFilter.java    From aion-germany with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Constructs a new Suffix file filter for an array of suffixs
 * specifying case-sensitivity.
 * <p>
 * The array is not cloned, so could be changed after constructing the
 * instance. This would be inadvisable however.
 * 
 * @param suffixes  the suffixes to allow, must not be null
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the suffix array is null
 * @since 1.4
 */
public SuffixFileFilter(String[] suffixes, IOCase caseSensitivity) {
    if (suffixes == null) {
        throw new IllegalArgumentException("The array of suffixes must not be null");
    }
    this.suffixes = new String[suffixes.length];
    System.arraycopy(suffixes, 0, this.suffixes, 0, suffixes.length);
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 9
Source File: SuffixFileFilter.java    From aion-germany with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Constructs a new Suffix file filter for a single extension
 * specifying case-sensitivity.
 *
 * @param suffix  the suffix to allow, must not be null
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 * @throws IllegalArgumentException if the suffix is null
 * @since 1.4
 */
public SuffixFileFilter(String suffix, IOCase caseSensitivity) {
    if (suffix == null) {
        throw new IllegalArgumentException("The suffix must not be null");
    }
    this.suffixes = new String[] {suffix};
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 10
Source File: SuffixFileFilter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new Suffix file filter for a single extension.
 *
 * @param suffix  the suffix to allow, must not be null
 * @throws IllegalArgumentException if the suffix is null
 */
public SuffixFileFilter(final String suffix) {
    this(suffix, IOCase.SENSITIVE);
}
 
Example 11
Source File: ExtensionFileComparator.java    From aion-germany with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Construct a file extension comparator instance with the specified case-sensitivity.
 *
 * @param caseSensitivity how to handle case sensitivity, null means case-sensitive
 */
public ExtensionFileComparator(IOCase caseSensitivity) {
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 12
Source File: PathFileComparator.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct a file path comparator instance with the specified case-sensitivity.
 *
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 */
public PathFileComparator(final IOCase caseSensitivity) {
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 13
Source File: PrefixFileFilter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new Prefix file filter for a single prefix.
 *
 * @param prefix  the prefix to allow, must not be null
 * @throws IllegalArgumentException if the prefix is null
 */
public PrefixFileFilter(final String prefix) {
    this(prefix, IOCase.SENSITIVE);
}
 
Example 14
Source File: SuffixFileFilter.java    From aion-germany with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Constructs a new Suffix file filter for a list of suffixes.
 * 
 * @param suffixes  the suffixes to allow, must not be null
 * @throws IllegalArgumentException if the suffix list is null
 * @throws ClassCastException if the list does not contain Strings
 */
public SuffixFileFilter(List<String> suffixes) {
    this(suffixes, IOCase.SENSITIVE);
}
 
Example 15
Source File: PrefixFileFilter.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Constructs a new Prefix file filter for a list of prefixes.
 *
 * @param prefixes  the prefixes to allow, must not be null
 * @throws IllegalArgumentException if the prefix list is null
 * @throws ClassCastException if the list does not contain Strings
 */
public PrefixFileFilter(final List<String> prefixes) {
    this(prefixes, IOCase.SENSITIVE);
}
 
Example 16
Source File: SuffixFileFilter.java    From aion-germany with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Constructs a new Suffix file filter for a single extension.
 * 
 * @param suffix  the suffix to allow, must not be null
 * @throws IllegalArgumentException if the suffix is null
 */
public SuffixFileFilter(String suffix) {
    this(suffix, IOCase.SENSITIVE);
}
 
Example 17
Source File: PrefixFileFilter.java    From aion-germany with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Constructs a new Prefix file filter for a single prefix.
 * 
 * @param prefix  the prefix to allow, must not be null
 * @throws IllegalArgumentException if the prefix is null
 */
public PrefixFileFilter(String prefix) {
    this(prefix, IOCase.SENSITIVE);
}
 
Example 18
Source File: NameFileComparator.java    From aion-germany with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Construct a file name comparator instance with the specified case-sensitivity.
 *
 * @param caseSensitivity  how to handle case sensitivity, null means case-sensitive
 */
public NameFileComparator(IOCase caseSensitivity) {
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 19
Source File: ExtensionFileComparator.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Construct a file extension comparator instance with the specified case-sensitivity.
 *
 * @param caseSensitivity how to handle case sensitivity, null means case-sensitive
 */
public ExtensionFileComparator(final IOCase caseSensitivity) {
    this.caseSensitivity = caseSensitivity == null ? IOCase.SENSITIVE : caseSensitivity;
}
 
Example 20
Source File: PrefixFileFilter.java    From aion-germany with GNU General Public License v3.0 2 votes vote down vote up
/**
 * Constructs a new Prefix file filter for a list of prefixes.
 * 
 * @param prefixes  the prefixes to allow, must not be null
 * @throws IllegalArgumentException if the prefix list is null
 * @throws ClassCastException if the list does not contain Strings
 */
public PrefixFileFilter(List<String> prefixes) {
    this(prefixes, IOCase.SENSITIVE);
}