Skip to content

Instantly share code, notes, and snippets.

@bingoogolapple
Created October 8, 2014 02:45
Show Gist options
  • Save bingoogolapple/0e418d9fd25f31364392 to your computer and use it in GitHub Desktop.
Save bingoogolapple/0e418d9fd25f31364392 to your computer and use it in GitHub Desktop.
public class ExtUtil {
private ExtUtil() {
}
public static boolean isVideo(String filePath) {
String ext = filePath.toLowerCase();
return ext.endsWith(".mp4") || ext.endsWith(".avi") || ext.endsWith(".wmv") || ext.endsWith(".rmvb") || ext.endsWith(".mpg") || ext.endsWith(".mpeg") || ext.endsWith(".3gp");
}
public static boolean isImage(String filePath) {
String ext = filePath.toLowerCase();
return ext.endsWith(".jpg") || ext.endsWith(".jpeg") || ext.endsWith(".png") || ext.endsWith(".gif") || ext.endsWith(".bmp");
}
public static boolean isAudio(String filePath) {
String ext = filePath.toLowerCase();
return ext.endsWith(".mp3") || ext.endsWith(".wav") || ext.endsWith(".wma") || ext.endsWith(".amr") || ext.endsWith(".ogg");
}
public static boolean isPpt(String filePath) {
String ext = filePath.toLowerCase();
return ext.endsWith(".ppt") || ext.endsWith(".pptx");
}
public static boolean isWord(String filePath) {
String ext = filePath.toLowerCase();
return ext.endsWith(".doc") || ext.endsWith(".docx");
}
public static boolean isExcel(String filePath) {
String ext = filePath.toLowerCase();
return ext.endsWith(".xls") || ext.endsWith(".xlsx");
}
public static boolean isApk(String filePath) {
return filePath.toLowerCase().endsWith(".apk");
}
public static boolean isPdf(String filePath) {
return filePath.toLowerCase().endsWith(".pdf");
}
public static boolean isTxt(String filePath) {
return filePath.toLowerCase().endsWith(".txt");
}
public static boolean isChm(String filePath) {
return filePath.toLowerCase().endsWith(".chm");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment