2
* Copyright 2002-2004 The Apache Software Foundation.
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
8
* http://www.apache.org/licenses/LICENSE-2.0
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
16
package org.apache.commons.io.filefilter;
21
* This filter produces a logical NOT of the filters specified.
23
* @since Commons IO 1.0
24
* @version $Revision: 1.6 $ $Date: 2004/02/23 04:37:57 $
26
* @author Stephen Colebourne
28
public class NotFileFilter extends AbstractFileFilter {
31
private IOFileFilter filter;
34
* Constructs a new file filter that NOTs the result of another filters.
36
* @param filter the filter, must not be null
37
* @throws IllegalArgumentException if the filter is null
39
public NotFileFilter(IOFileFilter filter) {
41
throw new IllegalArgumentException("The filter must not be null");
47
* Checks to see if both filters are true.
49
* @param file the File to check
50
* @return true if the filter returns false
52
public boolean accept(File file) {
53
return ! filter.accept(file);
57
* Checks to see if both filters are true.
59
* @param file the File directory
60
* @param name the filename
61
* @return true if the filter returns false
63
public boolean accept(File file, String name) {
64
return ! filter.accept(file, name);