mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-08-18 20:38:02 +08:00
fix(FileTypeUtil): 重构根据file magic number判断文件类型
1.重构多个Magic Number 2.根据单独类型匹配,修复某些文件跳位置对比 3.获取到文件Mime类型和后缀 4.获取文件流从28byte提升到64byte 5.添加精确匹配如docx、xlsx、pptx、doc、xls、ppt,精确匹配为8192byte(大小10k文件左右) 6.添加file magic number枚举 Closes https://github.com/dromara/hutool/issues/2821
This commit is contained in:
@@ -48,7 +48,7 @@ public class FileTypeUtilTest {
|
||||
@Ignore
|
||||
public void ofdTest() {
|
||||
File file = FileUtil.file("e:/test.ofd");
|
||||
String hex = IoUtil.readHex28Upper(FileUtil.getInputStream(file));
|
||||
String hex = IoUtil.readHex64Upper(FileUtil.getInputStream(file));
|
||||
Console.log(hex);
|
||||
String type = FileTypeUtil.getType(file);
|
||||
Console.log(type);
|
||||
|
||||
Reference in New Issue
Block a user