@Test public void testCustomFilter() throws Exception { File src = File.createTempFile(this.getClass().getSimpleName(), ".xml"); write(2048, src); CompositeFileFilter df = new CompositeFileFilter(FILTER_CUSTOM); boolean accepted = df.accept(src); String text = src + ", size=" + src.length() + " should not match"; src.delete(); assertFalse(text, accepted); }
@Override public boolean accept(File pathname) { int result = 0; for (FileFilter f : filters) { if (!quietMode) { log.trace("Checking {} is acceptable for {}", pathname.getAbsolutePath(), f.getClass().getSimpleName()); } result += f.accept(pathname) ? 1 : 0; } return result == filters.size(); }
CompositeFileFilter implements FileFilter { @Override public boolean accept(File pathname) { int result = 0; for (FileFilter f : filters) { if (!quietMode) { log.trace("Checking {} is acceptable for {}", pathname.getAbsolutePath(), f.getClass().getSimpleName()); } result += f.accept(pathname) ? 1 : 0; } return result == filters.size(); } }
CompositeFileFilter implements FileFilter { @Override public boolean accept(File pathname) { int result = 0; for (FileFilter f : filters) { if (!quietMode) { log.trace("Checking {} is acceptable for {}", pathname.getAbsolutePath(), f.getClass().getSimpleName()); } result += f.accept(pathname) ? 1 : 0; } return result == filters.size(); } private  CompositeFileFilter();  CompositeFileFilter(String filterExpression);  CompositeFileFilter(String filterExpression, boolean quiet); }
CompositeFileFilter implements FileFilter { @Override public boolean accept(File pathname) { int result = 0; for (FileFilter f : filters) { if (!quietMode) { log.trace("Checking {} is acceptable for {}", pathname.getAbsolutePath(), f.getClass().getSimpleName()); } result += f.accept(pathname) ? 1 : 0; } return result == filters.size(); } private  CompositeFileFilter();  CompositeFileFilter(String filterExpression);  CompositeFileFilter(String filterExpression, boolean quiet); @Override boolean accept(File pathname); }
CompositeFileFilter implements FileFilter { @Override public boolean accept(File pathname) { int result = 0; for (FileFilter f : filters) { if (!quietMode) { log.trace("Checking {} is acceptable for {}", pathname.getAbsolutePath(), f.getClass().getSimpleName()); } result += f.accept(pathname) ? 1 : 0; } return result == filters.size(); } private  CompositeFileFilter();  CompositeFileFilter(String filterExpression);  CompositeFileFilter(String filterExpression, boolean quiet); @Override boolean accept(File pathname);  }