1 22 23 package org.xquark.servlet.util; 24 25 import java.io.File ; 26 import java.io.FileFilter ; 27 28 29 32 public class FileExtensionFilter implements FileFilter  33 { 34 public String ext; 35 36 37 40 public FileExtensionFilter(String ext) 41 { 42 this.ext = ext.toLowerCase(); 43 } 44 45 46 49 public void setFileExtension(String ext) 50 { 51 this.ext = ext.toLowerCase(); 52 } 53 54 55 public boolean accept(File file) 56 { 57 if(file.isDirectory()) 58 return false; 59 if(file.getName().toLowerCase().endsWith(ext)) 60 return true; 61 return false; 62 } 63 } 64 65 | Popular Tags |