1 31 package org.pdfbox.util; 32 33 import java.io.File ; 34 import javax.swing.filechooser.FileFilter ; 35 36 37 43 public class ExtensionFileFilter extends FileFilter 44 { 45 private String [] extensions = null; 46 private String desc; 47 48 54 public ExtensionFileFilter( String [] ext, String description ) 55 { 56 extensions = ext; 57 desc = description; 58 } 59 60 63 public boolean accept(File pathname) 64 { 65 boolean acceptable = false; 66 String name = pathname.getName().toUpperCase(); 67 for( int i=0; !acceptable && i<extensions.length; i++ ) 68 { 69 if( name.endsWith( extensions[i].toUpperCase() ) ) 70 { 71 acceptable = true; 72 } 73 } 74 return acceptable; 75 } 76 77 80 public String getDescription() 81 { 82 return desc; 83 } 84 } 85 | Popular Tags |