Added getExtension. Added tempLibrary as constant

This commit is contained in:
nathan 2014-11-03 02:14:22 +01:00
parent 17ff06d212
commit 5cccdb692e
1 changed files with 13 additions and 1 deletions

View File

@ -62,6 +62,8 @@ public class FileUtil {
}
public static final String TEMP_DIR = System.getProperty("java.io.tmpdir");
public static byte[] ZIP_HEADER = { 'P', 'K', 0x3, 0x4 };
/**
@ -1395,5 +1397,15 @@ public class FileUtil {
return ch == UNIX_SEPARATOR || ch == WINDOWS_SEPARATOR;
}
/**
* Gets the extension of a file
*/
public static String getExtension(String fileName) {
int dot = fileName.lastIndexOf('.');
if (dot > -1) {
return fileName.substring(dot + 1);
} else {
return null;
}
}
}