1 50 package org.apache.avalon.excalibur.io; 51 52 import java.io.File ; 53 import java.io.FilenameFilter ; 54 55 77 public class ExtensionFileFilter 78 implements FilenameFilter 79 { 80 private String [] m_extensions; 81 82 public ExtensionFileFilter( final String [] extensions ) 83 { 84 m_extensions = extensions; 85 } 86 87 public ExtensionFileFilter( final String extension ) 88 { 89 m_extensions = new String []{extension}; 90 } 91 92 public boolean accept( final File file, final String name ) 93 { 94 for( int i = 0; i < m_extensions.length; i++ ) 95 { 96 if( name.endsWith( m_extensions[ i ] ) ) 97 { 98 return true; 99 } 100 } 101 return false; 102 } 103 } 104 105 106 | Popular Tags |