即使文件扩展名已被更改,如何识别文件类型? [英] How to identify the file type even though the file-extension has been changed?
问题描述
myVideo.mp4
的视频文件,我已将它更改为 myVideo.txt
。所以,如果我双击它,首选的文本编辑器将打开文件,并不会打开确切的内容。但是,如果我在视频播放器中播放 myVideo.txt
,则播放视频时不会有任何问题。 我只是想开发一个应用程序来确定文件的类型,而不检查文件扩展名,并建议打开文件的软件。我想在Java中开发应用程序。
结构,幻数,元数据,字符串和正则表达式,启发式和统计分析...这个工具只会和后面的规则数据库一样好。
尝试DROID( >)来识别文件类型; Java,Net BSD许可。这是英国国家档案馆的一个免费项目,与Android无关。源在Github和Sourceforge上可用。 DROID文档 很好。 另见 Darwinsys文件 libmagic 。
Files are categorized by file-extension. So my question is, how to identify the file type even the file extension has been changed.
For example, i have a video file with name myVideo.mp4
, i have changed it to myVideo.txt
. So if i double-click it, the preferred text editor will open the file, and won't open the exact content. But, if i play myVideo.txt
in a video player, the video will be played without any problem.
I was just thinking of developing an application to determine the type of file without checking the file-extension and suggesting the software for opening the file. I would like to develop the application in Java.
Structure, magic numbers, metadata, strings and regular expressions, heuristics and statistical analysis... the tool will only be as good as the database of rules behind it.
Try DROID (Digital Record Object IDentification tool) for identifying file types; Java, Net BSD-licensed. It is a free project of the National Archives UK, unrelated to Android. Source is available on Github and Sourceforge. DROID documentation is good.
See also Darwinsys file and libmagic.
这篇关于即使文件扩展名已被更改,如何识别文件类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!