-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFileTypes.java
More file actions
48 lines (47 loc) · 1.47 KB
/
Copy pathFileTypes.java
File metadata and controls
48 lines (47 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import java.util.ArrayList;
import java.util.Arrays;
/*
* Created on 31-10-2003 by jesper
* This class should
*/
/**
* @author jesper
*/
public class FileTypes {
public final static String CLASS = "class";
public final static String MANIFEST = "manifest";
public final static String MANIFEST2 = "mf";
public final static String GIF = "gif";
public final static String HTML = "html";
public final static String TXT = "txt";
public final static String TXT2 = "text";
public final static String JAVA = "java";
public final static String CSS = "css";
public static String getFileType(String name) {
if (name.indexOf(".") != -1 && name.length() > 3) {
String end = name.substring(name.lastIndexOf(".") + 1, name.length()).toLowerCase();
if (end.equals(FileTypes.CLASS)) {
return FileTypes.CLASS;
} else if (end.equals(FileTypes.MANIFEST)) {
return FileTypes.MANIFEST;
} else if (end.equals(FileTypes.MANIFEST2)) {
return FileTypes.MANIFEST;
} else if (end.equals(FileTypes.GIF)) {
return FileTypes.GIF;
} else if (end.equals(FileTypes.HTML)) {
return FileTypes.HTML;
} else if (end.equals(FileTypes.TXT)) {
return FileTypes.TXT;
} else if (end.equals(FileTypes.TXT2)) {
return FileTypes.TXT;
} else if (end.equals(FileTypes.JAVA)) {
return FileTypes.JAVA;
} else if (end.equals(FileTypes.CSS)) {
return FileTypes.CSS;
} else {
return "";
}
}
return "";
}
}