用 Java 读取 Windows 文件摘要属性(标题、主题、作者)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4096973/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 15:32:45  来源:igfitidea点击:

Reading Windows file summary properties (title, subject, author) in Java

javawindowsfilesummaryauthor

提问by p.mesotten

If you right-click on a file in Windows and select Properties, you can manage some properties in de Summarytab, such as Title, Subject and Author, like in this example:

如果您在 Windows 中右键单击一个文件并选择Properties,您可以在 de Summary选项卡中管理一些属性,例如 Title、Subject 和 Author,如下例所示:

alt text

替代文字

I'm trying to find a way to read these properties using Java. Is there a library for this? Is this even possible? Thanks in advance!

我正在尝试找到一种使用Java读取这些属性的方法。有图书馆吗?这甚至可能吗?提前致谢!

Peter

彼得

采纳答案by Michael Borgwardt

That information is stored in an NTFS Alternate Data Streamnamed "?SummaryInformation" - not sure if Java supports teh reading of ADS data via the colon notation.

该信息存储在名为“?SummaryInformation”的 NTFS备用数据流中- 不确定 Java 是否支持通过冒号表示法读取 ADS 数据。

Update:Apparently this should work:

更新:显然这应该有效:

FileInputStream in = new FileInputStream("test.txt:\u2663SummaryInformation");

You'll have to figure out the format yourself.

你必须自己弄清楚格式。

回答by Christian Kuetbach

In Java 7 it may work, but until then you have to use a native dll, to get that information.

在 Java 7 中它可能工作,但在那之前您必须使用本机 dll 来获取该信息。