1 16 package org.apache.commons.io.filefilter; 17 18 import java.io.File ; 19 20 28 public class OrFileFilter extends AbstractFileFilter { 29 30 31 private IOFileFilter filter1; 32 33 private IOFileFilter filter2; 34 35 42 public OrFileFilter(IOFileFilter filter1, IOFileFilter filter2) { 43 if (filter1 == null || filter2 == null) { 44 throw new IllegalArgumentException ("The filters must not be null"); 45 } 46 this.filter1 = filter1; 47 this.filter2 = filter2; 48 } 49 50 56 public boolean accept(File file) { 57 return filter1.accept(file) || filter2.accept(file); 58 } 59 60 67 public boolean accept(File file, String name) { 68 return filter1.accept(file, name) || filter2.accept(file, name); 69 } 70 71 } 72 | Popular Tags |