java 什么是 JAF?它的目的是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3067164/
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
What is JAF? What is its purpose?
提问by Manoj
I am unable to understand the purpose of JAF (Java Activation Framework). Please explain it to me in simple terms, or point me towards information.
我无法理解 JAF(Java 激活框架)的目的。请用简单的术语向我解释,或向我指出信息。
The Java Mail API is using JAF. It looks like the JAF is used to find the supporting data types of an object. But I couldn't understand.
Java 邮件 API 使用 JAF。看起来 JAF 用于查找对象的支持数据类型。但我无法理解。
Please teach me!
请教我!
回答by cletus
The JavaBeans Activation Framework is a library for abstracting the operating system specific bindings/mappings between file types and applications that deal with them. This can be based on MIME types and/or file extensions. It's really nothing more than that.
JavaBeans Activation Framework 是一个库,用于抽象文件类型和处理它们的应用程序之间的操作系统特定绑定/映射。这可以基于 MIME 类型和/或文件扩展名。真的仅此而已。
Open up Windows explorer and right click on a file. Various actions may be there (eg Open, Edit, Play). What actions are associated with the file is associated with the file extension on Windows. JAF is a portable version of that. It's mainly intended for desktop applications to be able to interact with whatever programs can be used with files on that computer.
打开 Windows 资源管理器并右键单击一个文件。可能存在各种操作(例如打开、编辑、播放)。与文件相关联的操作与 Windows 上的文件扩展名相关联。JAF 是它的便携版本。它主要用于桌面应用程序,以便能够与可以与该计算机上的文件一起使用的任何程序进行交互。
回答by Alex Martelli
It's actually the JavaBeansActivation Framework and I think the docsexplain it well:
它实际上是 Java BeansActivation Framework,我认为文档解释得很好:
With the JavaBeans Activation Framework standard extension, developers who use Java technology can take advantage of standard services to determine the type of an arbitrary piece of data, encapsulate access to it, discover the operations available on it, and to instantiate the appropriate bean to perform said operation(s). For example, if a browser obtained a JPEG image, this framework would enable the browser to identify that stream of data as an JPEG image, and from that type, the browser could locate and instantiate an object that could manipulate, or view that image.
通过 JavaBeans Activation Framework 标准扩展,使用 Java 技术的开发人员可以利用标准服务来确定任意数据的类型、封装对它的访问、发现对它的可用操作,并实例化适当的 bean 以执行所述操作。例如,如果浏览器获得了 JPEG 图像,该框架将使浏览器能够将该数据流识别为 JPEG 图像,并且从该类型中,浏览器可以定位并实例化可以操作或查看该图像的对象。
What parts of this paragraph are not clear to you?
你不清楚这一段的哪些部分?
回答by Tomá? Zálusky
OT: there is similar functionality in JDK7(although certainly cannot be considered as full replacement)

