1 22 package org.jboss.util.file; 23 24 import java.io.File ; 25 import java.io.FilenameFilter ; 26 27 33 public class FilenameSuffixFilter 34 implements FilenameFilter 35 { 36 37 protected final String suffix; 38 39 40 protected final boolean ignoreCase; 41 42 48 public FilenameSuffixFilter(final String suffix, 49 final boolean ignoreCase) 50 { 51 this.ignoreCase = ignoreCase; 52 this.suffix = (ignoreCase ? suffix.toLowerCase() : suffix); 53 } 54 55 60 public FilenameSuffixFilter(final String suffix) { 61 this(suffix, false); 62 } 63 64 71 public boolean accept(final File dir, final String name) { 72 if (ignoreCase) { 73 return name.toLowerCase().endsWith(suffix); 74 } 75 else { 76 return name.endsWith(suffix); 77 } 78 } 79 } 80 | Popular Tags |