1 21 22 package org.opensubsystems.core.util; 23 24 import java.io.File ; 25 import java.io.FileFilter ; 26 27 import org.opensubsystems.core.www.WebCommonConstants; 28 29 37 public class FileExtensionFilter implements FileFilter 38 { 39 41 44 public static final FileFilter JPEG_IMAGE_FILTER 45 = new FileExtensionFilter( 46 WebCommonConstants.JPEG_IMAGE_EXTENSION); 47 48 50 53 protected String m_strExtension; 54 55 57 62 public FileExtensionFilter( 63 String strExtension 64 ) 65 { 66 assert strExtension != null : "Extension cannot be null"; 67 m_strExtension = strExtension; 68 } 69 70 72 78 public boolean accept( 79 File flPathName 80 ) 81 { 82 return flPathName.isFile() 83 && flPathName.getName().toLowerCase().endsWith(m_strExtension); 84 } 85 } 86 | Popular Tags |