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)
- SM2加密速度慢 SecureUtil.generateKeyPair("SM2");加入这段代码后由1000ms变几十毫秒 HOT 1
- cn.hutool.http.HttpException: Unexpected end of file from server HOT 1
- BeanUtil对代理类型源对象拷贝失败 HOT 1
- JSONUtil.toBean时,如果Bean没有任何字段,会报错ConvertException: Can not Converter from [cn.hutool.json.JSONObject] to [xxx] HOT 6
- byte[]和数值转换问题咨询 HOT 3
- 根据身份证计算年龄逻辑不准确 HOT 1
- csv字段分隔符只能设置单个字符 HOT 1
- 在使用 hutool DB时的一些疑惑 HOT 3
- 建议:用文档训练一个AI,这样找方法的时候直接在AI里问 HOT 1
- java.lang.NoSuchMethodError
- HttpUtil工具get方法请求头Content-Type设置问题 HOT 1
- StrUtil split 判断问题 HOT 6
- Convert.digitToChinese(0),按照标准读法应该返回“零元整” HOT 3
- 有没有整合ip2region的计划 HOT 1
- 希望考虑 扩展tree功能 支持lambda模式写法 HOT 2
- ReflectUtil.invoke(Object obj, Method method, Object... args) 方法发生异常时,可以将obj、method 、 args 在异常信息里,打印出来吗?或者增加个log HOT 1
- ### 版本情况 HOT 1
- hutool.cn首页无法打开 HOT 4
- 能否把CharSequenceUtil里的方法在StrUtil里重写以规避sonar检测 HOT 4
- DateUtil.endOfDay的一个奇怪问题 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.