⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datahandler.html

📁 SUN公司官方J2EE中文帮助文档 应该不错 有兴趣的下来看看 html格式的
💻 HTML
📖 第 1 页 / 共 3 页
字号:
<CODE>&nbsp;boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/activation/DataHandler.html#isDataFlavorSupported(java.awt.datatransfer.DataFlavor)">isDataFlavorSupported</A></B>(java.awt.datatransfer.DataFlavor&nbsp;flavor)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns whether the specified data flavor is supported
 for this object.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/activation/DataHandler.html#setCommandMap(javax.activation.CommandMap)">setCommandMap</A></B>(<A HREF="../../javax/activation/CommandMap.html">CommandMap</A>&nbsp;commandMap)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the CommandMap for use by this DataHandler.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>static&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/activation/DataHandler.html#setDataContentHandlerFactory(javax.activation.DataContentHandlerFactory)">setDataContentHandlerFactory</A></B>(<A HREF="../../javax/activation/DataContentHandlerFactory.html">DataContentHandlerFactory</A>&nbsp;newFactory)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the DataContentHandlerFactory.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>&nbsp;void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../javax/activation/DataHandler.html#writeTo(java.io.OutputStream)">writeTo</A></B>(java.io.OutputStream&nbsp;os)</CODE>

<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Write the data to an <code>OutputStream</code>.</TD>
</TR>
</TABLE>
&nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
&nbsp;
<P>

<!-- ============ FIELD DETAIL =========== -->


<!-- ========= CONSTRUCTOR DETAIL ======== -->

<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="DataHandler(javax.activation.DataSource)"><!-- --></A><H3>
DataHandler</H3>
<PRE>
public <B>DataHandler</B>(<A HREF="../../javax/activation/DataSource.html">DataSource</A>&nbsp;ds)</PRE>
<DL>
<DD>Create a <code>DataHandler</code> instance referencing the
 specified DataSource.  The data exists in a byte stream form.
 The DataSource will provide an InputStream to access the data.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ds</CODE> - the DataSource</DL>
</DD>
</DL>
<HR>

<A NAME="DataHandler(java.lang.Object, java.lang.String)"><!-- --></A><H3>
DataHandler</H3>
<PRE>
public <B>DataHandler</B>(java.lang.Object&nbsp;obj,
                   java.lang.String&nbsp;mimeType)</PRE>
<DL>
<DD>Create a <code>DataHandler</code> instance representing an object
 of this MIME type.  This constructor is
 used when the application already has an in-memory representation
 of the data in the form of a Java Object.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>obj</CODE> - the Java Object<DD><CODE>mimeType</CODE> - the MIME type of the object</DL>
</DD>
</DL>
<HR>

<A NAME="DataHandler(java.net.URL)"><!-- --></A><H3>
DataHandler</H3>
<PRE>
public <B>DataHandler</B>(java.net.URL&nbsp;url)</PRE>
<DL>
<DD>Create a <code>DataHandler</code> instance referencing a URL.
 The DataHandler internally creates a <code>URLDataSource</code>
 instance to represent the URL.<DD><DL>
<DT><B>Parameters:</B><DD><CODE>url</CODE> - a URL object</DL>
</DD>
</DL>

<!-- ============ METHOD DETAIL ========== -->

<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>

<A NAME="getDataSource()"><!-- --></A><H3>
getDataSource</H3>
<PRE>
public <A HREF="../../javax/activation/DataSource.html">DataSource</A> <B>getDataSource</B>()</PRE>
<DL>
<DD>Return the DataSource associated with this instance
 of DataHandler.
 <p>
 For DataHandlers that have been instantiated with a DataSource,
 this method returns the DataSource that was used to create the
 DataHandler object. In other cases the DataHandler
 constructs a DataSource from the data used to construct
 the DataHandler. DataSources created for DataHandlers <b>not</b>
 instantiated with a DataSource are cached for performance
 reasons.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>a valid DataSource object for this DataHandler</DL>
</DD>
</DL>
<HR>

<A NAME="getName()"><!-- --></A><H3>
getName</H3>
<PRE>
public java.lang.String <B>getName</B>()</PRE>
<DL>
<DD>Return the name of the data object. If this DataHandler
 was created with a DataSource, this method calls through
 to the <code>DataSource.getName</code> method, otherwise it
 returns <i>null</i>.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the name of the object</DL>
</DD>
</DL>
<HR>

<A NAME="getContentType()"><!-- --></A><H3>
getContentType</H3>
<PRE>
public java.lang.String <B>getContentType</B>()</PRE>
<DL>
<DD>Return the MIME type of this object as retrieved from
 the source object. Note that this is the <i>full</i>
 type with parameters.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the MIME type</DL>
</DD>
</DL>
<HR>

<A NAME="getInputStream()"><!-- --></A><H3>
getInputStream</H3>
<PRE>
public java.io.InputStream <B>getInputStream</B>()
                                   throws java.io.IOException</PRE>
<DL>
<DD>Get the InputStream for this object. <p>

 For DataHandlers instantiated with a DataSource, the DataHandler
 calls the <code>DataSource.getInputStream</code> method and
 returns the result to the caller.
 <p>
 For DataHandlers instantiated with an Object, the DataHandler
 first attempts to find a DataContentHandler for the Object. If
 the DataHandler can not find a DataContentHandler for this MIME
 type, it throws an UnsupportedDataTypeException.  If it is
 successful, it creates a pipe and a thread.  The thread uses the
 DataContentHandler's <code>writeTo</code> method to write the
 stream data into one end of the pipe.  The other end of the pipe
 is returned to the caller.  Because a thread is created to copy
 the data, IOExceptions that may occur during the copy can not be
 propagated back to the caller. The result is an empty stream.<p><DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the InputStream representing this data<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an I/O error occurs<DT><B>See Also: </B><DD><A HREF="../../javax/activation/DataContentHandler.html#writeTo(java.lang.Object, java.lang.String, java.io.OutputStream)"><CODE>DataContentHandler.writeTo(java.lang.Object, java.lang.String, java.io.OutputStream)</CODE></A>, 
<A HREF="../../javax/activation/UnsupportedDataTypeException.html"><CODE>UnsupportedDataTypeException</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="writeTo(java.io.OutputStream)"><!-- --></A><H3>
writeTo</H3>
<PRE>
public void <B>writeTo</B>(java.io.OutputStream&nbsp;os)
             throws java.io.IOException</PRE>
<DL>
<DD>Write the data to an <code>OutputStream</code>.<p>

 If the DataHandler was created with a DataSource, writeTo
 retrieves the InputStream and copies the bytes from the
 InputStream to the OutputStream passed in.
 <p>
 If the DataHandler was created with an object, writeTo
 retrieves the DataContentHandler for the object's type.
 If the DataContentHandler was found, it calls the
 <code>writeTo</code> method on the <code>DataContentHandler</code>.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>os</CODE> - the OutputStream to write to<DT><B>Throws:</B><DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>

<A NAME="getOutputStream()"><!-- --></A><H3>
getOutputStream</H3>
<PRE>
public java.io.OutputStream <B>getOutputStream</B>()
                                     throws java.io.IOException</PRE>
<DL>
<DD>Get an OutputStream for this DataHandler to allow overwriting
 the underlying data.
 If the DataHandler was created with a DataSource, the
 DataSource's <code>getOutputStream</code> method is called.
 Otherwise, <code>null</code> is returned.<DD><DL>
</DL>
</DD>
<DD><DL>
<DT><B>Returns:</B><DD>the OutputStream<DT><B>See Also: </B><DD><A HREF="../../javax/activation/DataSource.html#getOutputStream()"><CODE>DataSource.getOutputStream()</CODE></A>, 
<A HREF="../../javax/activation/URLDataSource.html"><CODE>URLDataSource</CODE></A></DL>
</DD>
</DL>
<HR>

<A NAME="getTransferDataFlavors()"><!-- --></A><H3>
getTransferDataFlavors</H3>
<PRE>
public java.awt.datatransfer.DataFlavor[] <B>getTransferDataFlavors</B>()</PRE>
<DL>
<DD>Return the DataFlavors in which this data is available. <p>

 Returns an array of DataFlavor objects indicating the flavors
 the data can be provided in. The array is usually ordered
 according to preference for providing the data, from most
 richly descriptive to least richly descriptive.<p>

 The DataHandler attempts to find a DataContentHandler that
 corresponds to the MIME type of the data. If one is located,
 the DataHandler calls the DataContentHandler's
 <code>getTransferDataFlavors</code> method. <p>

 If a DataContentHandler can <i>not</i> be located, and if the
 DataHandler was created with a DataSource (or URL), one
 DataFlavor is returned that represents this object's MIME type

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -