@Test public void testAccept() { final Pattern pattern = Pattern.compile(".*~\\..*|\\.DS_Store|\\.svn|CVS|RCS|SCCS|\\.git|\\.bzr|\\.bzrignore|\\.bzrtags|\\.hg|\\.hgignore|\\.hgtags|_darcs|\\.file-segments"); assertFalse(new DownloadRegexFilter(pattern).accept(new Path(".DS_Store", EnumSet.of(Path.Type.file)))); assertTrue(new DownloadRegexFilter(pattern).accept(new Path("f", EnumSet.of(Path.Type.file)))); assertTrue(new DownloadRegexFilter(Pattern.compile("")).accept(new Path("f", EnumSet.of(Path.Type.file)))); assertTrue(new DownloadRegexFilter(Pattern.compile("")).accept(new Path("f", EnumSet.of(Path.Type.file)))); }
@Override public boolean accept(final Path file) { if(!super.accept(file)) { return false; } if(pattern.matcher(file.getName()).matches()) { if(log.isDebugEnabled()) { log.debug(String.format("Skip %s excluded with regex", file.getAbsolute())); } return false; } return true; }
DownloadRegexFilter extends DownloadDuplicateFilter { @Override public boolean accept(final Path file) { if(!super.accept(file)) { return false; } if(pattern.matcher(file.getName()).matches()) { if(log.isDebugEnabled()) { log.debug(String.format("Skip %s excluded with regex", file.getAbsolute())); } return false; } return true; } }
DownloadRegexFilter extends DownloadDuplicateFilter { @Override public boolean accept(final Path file) { if(!super.accept(file)) { return false; } if(pattern.matcher(file.getName()).matches()) { if(log.isDebugEnabled()) { log.debug(String.format("Skip %s excluded with regex", file.getAbsolute())); } return false; } return true; } DownloadRegexFilter();  DownloadRegexFilter(final Pattern pattern); }
DownloadRegexFilter extends DownloadDuplicateFilter { @Override public boolean accept(final Path file) { if(!super.accept(file)) { return false; } if(pattern.matcher(file.getName()).matches()) { if(log.isDebugEnabled()) { log.debug(String.format("Skip %s excluded with regex", file.getAbsolute())); } return false; } return true; } DownloadRegexFilter();  DownloadRegexFilter(final Pattern pattern); @Override boolean accept(final Path file); @Override Pattern toPattern(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode(); }
DownloadRegexFilter extends DownloadDuplicateFilter { @Override public boolean accept(final Path file) { if(!super.accept(file)) { return false; } if(pattern.matcher(file.getName()).matches()) { if(log.isDebugEnabled()) { log.debug(String.format("Skip %s excluded with regex", file.getAbsolute())); } return false; } return true; } DownloadRegexFilter();  DownloadRegexFilter(final Pattern pattern); @Override boolean accept(final Path file); @Override Pattern toPattern(); @Override String toString(); @Override boolean equals(final Object o); @Override int hashCode();  }