📄 datahandler.html
字号:
and the <code>java.io.InputStream</code> class. If the
DataHandler was created with an object and a MIME type,
getTransferDataFlavors returns one DataFlavor that represents
this object's MIME type and the object's class.<DD><DL>
<DT><B>Specified by: </B><DD><CODE>getTransferDataFlavors</CODE> in interface <CODE>java.awt.datatransfer.Transferable</CODE></DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>an array of data flavors in which this data can be transferred<DT><B>See Also: </B><DD><A HREF="../../javax/activation/DataContentHandler.html#getTransferDataFlavors()"><CODE>DataContentHandler.getTransferDataFlavors()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="isDataFlavorSupported(java.awt.datatransfer.DataFlavor)"><!-- --></A><H3>
isDataFlavorSupported</H3>
<PRE>
public boolean <B>isDataFlavorSupported</B>(java.awt.datatransfer.DataFlavor flavor)</PRE>
<DL>
<DD>Returns whether the specified data flavor is supported
for this object.<p>
This method iterates through the DataFlavors returned from
<code>getTransferDataFlavors</code>, comparing each with
the specified flavor.<DD><DL>
<DT><B>Specified by: </B><DD><CODE>isDataFlavorSupported</CODE> in interface <CODE>java.awt.datatransfer.Transferable</CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>flavor</CODE> - the requested flavor for the data<DT><B>Returns:</B><DD>true if the data flavor is supported<DT><B>See Also: </B><DD><A HREF="../../javax/activation/DataHandler.html#getTransferDataFlavors()"><CODE>getTransferDataFlavors()</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getTransferData(java.awt.datatransfer.DataFlavor)"><!-- --></A><H3>
getTransferData</H3>
<PRE>
public java.lang.Object <B>getTransferData</B>(java.awt.datatransfer.DataFlavor flavor)
throws java.awt.datatransfer.UnsupportedFlavorException,
java.io.IOException</PRE>
<DL>
<DD>Returns an object that represents the data to be
transferred. The class of the object returned is defined by the
representation class of the data flavor.<p>
<b>For DataHandler's created with DataSources or URLs:</b><p>
The DataHandler attempts to locate a DataContentHandler
for this MIME type. If one is found, the passed in DataFlavor
and the type of the data are passed to its <code>getTransferData</code>
method. If the DataHandler fails to locate a DataContentHandler
and the flavor specifies this object's MIME type and the
<code>java.io.InputStream</code> class, this object's InputStream
is returned.
Otherwise it throws an UnsupportedFlavorException. <p>
<b>For DataHandler's created with Objects:</b><p>
The DataHandler attempts to locate a DataContentHandler
for this MIME type. If one is found, the passed in DataFlavor
and the type of the data are passed to its getTransferData
method. If the DataHandler fails to locate a DataContentHandler
and the flavor specifies this object's MIME type and its class,
this DataHandler's referenced object is returned.
Otherwise it throws an UnsupportedFlavorException.<DD><DL>
<DT><B>Specified by: </B><DD><CODE>getTransferData</CODE> in interface <CODE>java.awt.datatransfer.Transferable</CODE></DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>flavor</CODE> - the requested flavor for the data<DT><B>Returns:</B><DD>the object<DT><B>Throws:</B><DD><CODE>java.awt.datatransfer.UnsupportedFlavorException</CODE> - if the data could not be
converted to the requested flavor<DD><CODE>java.io.IOException</CODE> - if an I/O error occurs<DT><B>See Also: </B><DD><A HREF="../../javax/activation/ActivationDataFlavor.html"><CODE>ActivationDataFlavor</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="setCommandMap(javax.activation.CommandMap)"><!-- --></A><H3>
setCommandMap</H3>
<PRE>
public void <B>setCommandMap</B>(<A HREF="../../javax/activation/CommandMap.html">CommandMap</A> commandMap)</PRE>
<DL>
<DD>Set the CommandMap for use by this DataHandler.
Setting it to <code>null</code> causes the CommandMap to revert
to the CommandMap returned by the
<code>CommandMap.getDefaultCommandMap</code> method.
Changing the CommandMap, or setting it to <code>null</code>,
clears out any data cached from the previous CommandMap.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>commandMap</CODE> - the CommandMap to use in this DataHandler<DT><B>See Also: </B><DD><A HREF="../../javax/activation/CommandMap.html#setDefaultCommandMap(javax.activation.CommandMap)"><CODE>CommandMap.setDefaultCommandMap(javax.activation.CommandMap)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getPreferredCommands()"><!-- --></A><H3>
getPreferredCommands</H3>
<PRE>
public <A HREF="../../javax/activation/CommandInfo.html">CommandInfo</A>[] <B>getPreferredCommands</B>()</PRE>
<DL>
<DD>Return the <i>preferred</i> commands for this type of data.
This method calls the <code>getPreferredCommands</code> method
in the CommandMap associated with this instance of DataHandler.
This method returns an array that represents a subset of
available commands. In cases where multiple commands for the
MIME type represented by this DataHandler are present, the
installed CommandMap chooses the appropriate commands.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the CommandInfo objects representing the preferred commands<DT><B>See Also: </B><DD><A HREF="../../javax/activation/CommandMap.html#getPreferredCommands(java.lang.String)"><CODE>CommandMap.getPreferredCommands(java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getAllCommands()"><!-- --></A><H3>
getAllCommands</H3>
<PRE>
public <A HREF="../../javax/activation/CommandInfo.html">CommandInfo</A>[] <B>getAllCommands</B>()</PRE>
<DL>
<DD>Return all the commands for this type of data.
This method returns an array containing all commands
for the type of data represented by this DataHandler. The
MIME type for the underlying data represented by this DataHandler
is used to call through to the <code>getAllCommands</code> method
of the CommandMap associated with this DataHandler.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the CommandInfo objects representing all the commands<DT><B>See Also: </B><DD><A HREF="../../javax/activation/CommandMap.html#getAllCommands(java.lang.String)"><CODE>CommandMap.getAllCommands(java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getCommand(java.lang.String)"><!-- --></A><H3>
getCommand</H3>
<PRE>
public <A HREF="../../javax/activation/CommandInfo.html">CommandInfo</A> <B>getCommand</B>(java.lang.String cmdName)</PRE>
<DL>
<DD>Get the command <i>cmdName</i>. Use the search semantics as
defined by the CommandMap installed in this DataHandler. The
MIME type for the underlying data represented by this DataHandler
is used to call through to the <code>getCommand</code> method
of the CommandMap associated with this DataHandler.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>cmdName</CODE> - the command name<DT><B>Returns:</B><DD>the CommandInfo corresponding to the command<DT><B>See Also: </B><DD><A HREF="../../javax/activation/CommandMap.html#getCommand(java.lang.String, java.lang.String)"><CODE>CommandMap.getCommand(java.lang.String, java.lang.String)</CODE></A></DL>
</DD>
</DL>
<HR>
<A NAME="getContent()"><!-- --></A><H3>
getContent</H3>
<PRE>
public java.lang.Object <B>getContent</B>()
throws java.io.IOException</PRE>
<DL>
<DD>Return the data in its preferred Object form. <p>
If the DataHandler was instantiated with an object, return
the object. <p>
If the DataHandler was instantiated with a DataSource,
this method uses a DataContentHandler to return the content
object for the data represented by this DataHandler. If no
<code>DataContentHandler</code> can be found for the
the type of this data, the DataHandler returns an
InputStream for the data.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the content.<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an IOException occurs during
this operation.</DL>
</DD>
</DL>
<HR>
<A NAME="getBean(javax.activation.CommandInfo)"><!-- --></A><H3>
getBean</H3>
<PRE>
public java.lang.Object <B>getBean</B>(<A HREF="../../javax/activation/CommandInfo.html">CommandInfo</A> cmdinfo)</PRE>
<DL>
<DD>A convenience method that takes a CommandInfo object
and instantiates the corresponding command, usually
a JavaBean component.
<p>
This method calls the CommandInfo's <code>getCommandObject</code>
method with the <code>ClassLoader</code> used to load
the <code>javax.activation.DataHandler</code> class itself.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>cmdinfo</CODE> - the CommandInfo corresponding to a command<DT><B>Returns:</B><DD>the instantiated command object</DL>
</DD>
</DL>
<HR>
<A NAME="setDataContentHandlerFactory(javax.activation.DataContentHandlerFactory)"><!-- --></A><H3>
setDataContentHandlerFactory</H3>
<PRE>
public static void <B>setDataContentHandlerFactory</B>(<A HREF="../../javax/activation/DataContentHandlerFactory.html">DataContentHandlerFactory</A> newFactory)</PRE>
<DL>
<DD>Sets the DataContentHandlerFactory. The DataContentHandlerFactory
is called first to find DataContentHandlers.
The DataContentHandlerFactory can only be set once.
<p>
If the DataContentHandlerFactory has already been set,
this method throws an Error.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>factory</CODE> - the DataContentHandlerFactory<DT><B>Throws:</B><DD><CODE>java.lang.Error</CODE> - if the factory has already been defined.<DT><B>See Also: </B><DD><A HREF="../../javax/activation/DataContentHandlerFactory.html"><CODE>DataContentHandlerFactory</CODE></A></DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ========== START OF NAVBAR ========== -->
<A NAME="navbar_bottom"><!-- --></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0">
<TR>
<TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../javax/activation/CommandMap.html"><B>PREV CLASS</B></A>
<A HREF="../../javax/activation/FileDataSource.html"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../index.html" TARGET="_top"><B>FRAMES</B></A>
<A HREF="DataHandler.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: INNER | FIELD | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: FIELD | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<!-- =========== END OF NAVBAR =========== -->
<HR>
</BODY>
</HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -