UNPKG

epubjs

Version:

Render ePub documents in the browser, across many devices

19 lines (18 loc) 2.37 kB
<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><title>The Java Activation Framework</title><link rel="stylesheet" href="core.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.74.0"/></head><body><div class="sect1" title="The Java Activation Framework"><div class="titlepage"><div><div><h1 class="title"><a id="learnjava3-CHP-22-SECT-12"/>The Java Activation Framework</h1></div></div></div><p><a id="I_indexterm22_id824466" class="indexterm"/> <a id="I_indexterm22_id824473" class="indexterm"/> <a id="I_indexterm22_id824480" class="indexterm"/>The Java Activation Framework (JAF) can be used by beans that work with many external data types, such as media retrieved from files and streams. It is essentially a generalized content/protocol handler mechanism for JavaBeans. The <a id="I_indexterm22_id824491" class="indexterm"/><code class="literal">javax.activation</code> package contains an extensible set of classes that wrap arbitrary, raw data sources to provide access to their data as streams or objects, identify the MIME type of the data, and enumerate a registered set of “commands” for operating on the data.</p><p>The JAF provides two primary interfaces: <code class="literal">DataSource</code> and <code class="literal">DataHandler</code>. The <code class="literal">DataSource</code> acts like the protocol handlers we discussed in <a class="xref" href="ch14.html" title="Chapter 14. Programming for the Web">Chapter 14</a>. It wraps the data source and determines a MIME type for the data stream. The <code class="literal">DataHandler</code> acts like a content handler, except it provides a great deal more than access to the data. A <code class="literal">DataHandler</code> is constructed to wrap a <code class="literal">DataSource</code> and interpret the data in different forms. It also provides a list of command operations that can be used to access the data. <code class="literal">DataHandler</code> also implements the <code class="literal">java.awt.datatransfer.Transferable</code> interface, allowing data to be passed among application components in a well-defined way.</p></div></body></html>