Audio Files Filter
import java.io.File;
import java.io.FilenameFilter;
public class AudioFilesFilter implements FilenameFilter {
private final static String[] acceptedExtensions= {"mp3", "mp2", "wav", "flac", "ogg", "au" , "snd", "mid", "midi", "kar"
, "mga", "aif", "aiff", "aifc", "m3u", "oga", "spx"};
@Override
public boolean accept(File dir, String filename) {
for (int _i=0; _i < acceptedExtensions.length ; _i++){
if (filename.endsWith("." + acceptedExtensions[_i])) return true;
}
return false;
}
}
Related examples in the same category