Comments (2)
这块逻辑是这样的:
先发现是zip,则继续判断是否为office格式:
但是也会存在判断不准确的问题,这是文件本身的问题。考虑使用扩展名辅助判断。
from hutool.
还有一个问题,由于office文件的标识很容易被破坏,隐藏的也比较深(没有在前几十字节),所以建议您尝试下
String typeByPath = FileTypeUtil.getType((FileUtil.getInputStream("/Users/lin/code/mine/java/hutool_test/src/main/java/org/example/sql/新建 Microsoft Word 文档.docx")),true);
本地测试应该没有问题,注意不要使用wps修改,这个我也没办法,他会写很多自己的信息到文件信息里面。
from hutool.
Related Issues (20)
- FileUtil.copyFile()实际效果与注释不一致 HOT 1
- [Hutool-Captcha] 无法生成透明背景的验证码 HOT 1
- 请问一下HttpUtil executeAsync方式是否需要手动关闭 HOT 3
- xml转jsonobject,xml标签中的字符串&被转成了& HOT 1
- 使用outlook账号密码发送邮件失败 HOT 3
- .JSONObject#putByPath 方法传入的路径表达式中存在纯数字字符串生成的 json 对象有问题 HOT 2
- isAM()无法正确识别centOS系统的时间 HOT 2
- JDK21 环境下 ClassUtil.scanPackage 失效 HOT 1
- DateUtil在使用graalvm打包native之后,会有时区问题 HOT 1
- ScrpitUtils运行js脚本无法进行读取的require关键字 HOT 1
- 为什么 Action 报错不打印异常堆栈 HOT 8
- FuncComparator.thenComparing 不生效 HOT 6
- BeanUtil支持list到bean对象的深拷贝吗?如果不支持,请问用什么方法可以list到bean对象的深拷贝? HOT 1
- 请问有没有时间相互转换的工具? HOT 3
- VelocityEngine 模板引擎找不到文件 HOT 1
- 利用 JSR-305 元注释向支持 JSR-305 的常用工具指示 Java 中的可为空性 HOT 2
- Cannot read the array length because "<local3>" is null HOT 6
- 读取文件超过3GB时报java.lang.NegativeArraySizeException: -221445712 HOT 1
- 关于@Alias注解的一些使用建议 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hutool.