1 23 package com.sun.enterprise.util; 24 25 import java.io.File ; 26 import java.io.FilenameFilter ; 27 28 35 36 public class SimpleFilenameFilter implements FilenameFilter { 37 private String [] extensions = {}; 38 39 public SimpleFilenameFilter(String [] extensions) { 40 this.extensions = extensions; 41 } 42 43 public boolean accept(File pathname, String s) { 44 if ( (new File (pathname, s)).isDirectory() ) { 45 return true; 46 } else { 47 if (extensions == null) { 48 return true; 49 } 50 } 51 for (int i = 0; i < extensions.length; i++) { 52 if ( s.endsWith(extensions[i]) ) { 53 return true; 54 } 55 } 56 return false; 57 58 } 59 } 60 61 | Popular Tags |