|
@@ -53,6 +53,9 @@ public class FileUtil {
|
|
|
FILE_TYPE_MAP.put("0e574b", "wps/wks");
|
|
FILE_TYPE_MAP.put("0e574b", "wps/wks");
|
|
|
FILE_TYPE_MAP.put("ff0002", "wps/wks");
|
|
FILE_TYPE_MAP.put("ff0002", "wps/wks");
|
|
|
|
|
|
|
|
|
|
+ //exe可执行文件
|
|
|
|
|
+ FILE_TYPE_MAP.put("4d5a90", "exe");
|
|
|
|
|
+
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
public static boolean checkFile(InputStream inputStream){
|
|
public static boolean checkFile(InputStream inputStream){
|
|
@@ -61,6 +64,7 @@ public class FileUtil {
|
|
|
inputStream.read(headBytes, 0, headBytes.length);
|
|
inputStream.read(headBytes, 0, headBytes.length);
|
|
|
String headStr = bytesToHexString(headBytes).toLowerCase();
|
|
String headStr = bytesToHexString(headBytes).toLowerCase();
|
|
|
log.info("The Head of File: "+headStr);
|
|
log.info("The Head of File: "+headStr);
|
|
|
|
|
+// log.info("Whether the map contain the " + headStr +": " + FILE_TYPE_MAP.containsKey(headStr));
|
|
|
return FILE_TYPE_MAP.containsKey(headStr);
|
|
return FILE_TYPE_MAP.containsKey(headStr);
|
|
|
} catch (IOException e) {
|
|
} catch (IOException e) {
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|