Skip to content

Instantly share code, notes, and snippets.

@haies
Last active March 16, 2018 08:38
Show Gist options
  • Select an option

  • Save haies/0891f11ebc5ceadbd3400f5a3639e55c to your computer and use it in GitHub Desktop.

Select an option

Save haies/0891f11ebc5ceadbd3400f5a3639e55c to your computer and use it in GitHub Desktop.
getFilterFiles
private File[] getFilterFiles(String path, String[] suffix) {
File baseFolder = new File(path);
if(!baseFolder.isDirectory())return null;
FileFilter imageFilter = pathname -> {
String fileName = pathname.getName().toLowerCase();
for (String s : suffix) {
if (fileName.endsWith(s.toLowerCase())) return true;
}
return false;
};
return baseFolder.listFiles(imageFilter);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment