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

📄 urlconnection.html

📁 API資料大全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static&nbsp;<A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#guessContentTypeFromStream(java.io.InputStream)">guessContentTypeFromStream</A></B>(<A HREF="../../java/io/InputStream.html">InputStream</A>&nbsp;is)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Tries to determine the type of an input stream based on the  characters at the beginning of the input stream.</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="../../java/net/URLConnection.html#setAllowUserInteraction(boolean)">setAllowUserInteraction</A></B>(boolean&nbsp;allowuserinteraction)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Set the value of the <code>allowUserInteraction</code> field of  this <code>URLConnection</code>.</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="../../java/net/URLConnection.html#setContentHandlerFactory(java.net.ContentHandlerFactory)">setContentHandlerFactory</A></B>(<A HREF="../../java/net/ContentHandlerFactory.html">ContentHandlerFactory</A>&nbsp;fac)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the <code>ContentHandlerFactory</code> of an  application.</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="../../java/net/URLConnection.html#setDefaultAllowUserInteraction(boolean)">setDefaultAllowUserInteraction</A></B>(boolean&nbsp;defaultallowuserinteraction)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the default value of the  <code>allowUserInteraction</code> field for all future  <code>URLConnection</code> objects to the specified value.</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="../../java/net/URLConnection.html#setDefaultRequestProperty(java.lang.String, java.lang.String)">setDefaultRequestProperty</A></B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;key,                          <A HREF="../../java/lang/String.html">String</A>&nbsp;value)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<I>The instance specific setRequestProperty method should be used after an appropriate instance of URLConnection is obtained.</I></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="../../java/net/URLConnection.html#setDefaultUseCaches(boolean)">setDefaultUseCaches</A></B>(boolean&nbsp;defaultusecaches)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the default value of the <code>useCaches</code> field to the  specified value.</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="../../java/net/URLConnection.html#setDoInput(boolean)">setDoInput</A></B>(boolean&nbsp;doinput)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the value of the <code>doInput</code> field for this  <code>URLConnection</code> to the specified value.</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="../../java/net/URLConnection.html#setDoOutput(boolean)">setDoOutput</A></B>(boolean&nbsp;dooutput)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the value of the <code>doOutput</code> field for this  <code>URLConnection</code> to the specified value.</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="../../java/net/URLConnection.html#setFileNameMap(java.net.FileNameMap)">setFileNameMap</A></B>(<A HREF="../../java/net/FileNameMap.html">FileNameMap</A>&nbsp;map)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the FileNameMap.</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="../../java/net/URLConnection.html#setIfModifiedSince(long)">setIfModifiedSince</A></B>(long&nbsp;ifmodifiedsince)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the value of the <code>ifModifiedSince</code> field of  this <code>URLConnection</code> to the specified value.</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="../../java/net/URLConnection.html#setRequestProperty(java.lang.String, java.lang.String)">setRequestProperty</A></B>(<A HREF="../../java/lang/String.html">String</A>&nbsp;key,                   <A HREF="../../java/lang/String.html">String</A>&nbsp;value)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the general request property.</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="../../java/net/URLConnection.html#setUseCaches(boolean)">setUseCaches</A></B>(boolean&nbsp;usecaches)</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Sets the value of the <code>useCaches</code> field of this  <code>URLConnection</code> to the specified value.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>&nbsp;<A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#toString()">toString</A></B>()</CODE><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Returns a <code>String</code> representation of this URL connection.</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.<A HREF="../../java/lang/Object.html">Object</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/lang/Object.html#clone()">clone</A>, <A HREF="../../java/lang/Object.html#equals(java.lang.Object)">equals</A>, <A HREF="../../java/lang/Object.html#finalize()">finalize</A>, <A HREF="../../java/lang/Object.html#getClass()">getClass</A>, <A HREF="../../java/lang/Object.html#hashCode()">hashCode</A>, <A HREF="../../java/lang/Object.html#notify()">notify</A>, <A HREF="../../java/lang/Object.html#notifyAll()">notifyAll</A>, <A HREF="../../java/lang/Object.html#wait()">wait</A>, <A HREF="../../java/lang/Object.html#wait(long)">wait</A>, <A HREF="../../java/lang/Object.html#wait(long, int)">wait</A></CODE></TD></TR></TABLE>&nbsp;<P><!-- ============ FIELD DETAIL =========== --><A NAME="field_detail"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=1><FONT SIZE="+2"><B>Field Detail</B></FONT></TD></TR></TABLE><A NAME="url"><!-- --></A><H3>url</H3><PRE>protected <A HREF="../../java/net/URL.html">URL</A> <B>url</B></PRE><DL><DD>The URL represents the remote object on the World Wide Web to  which this connection is opened.  <p> The value of this field can be accessed by the  <code>getURL</code> method.  <p> The default value of this variable is the value of the URL  argument in the <code>URLConnection</code> constructor.<DD><DL><DT><B>See Also: </B><DD><A HREF="../../java/net/URLConnection.html#getURL()"><CODE>getURL()</CODE></A>, <A HREF="../../java/net/URLConnection.html#url"><CODE>url</CODE></A></DL></DD></DL><HR><A NAME="doInput"><!-- --></A><H3>doInput</H3><PRE>protected boolean <B>doInput</B></PRE><DL><DD>This variable is set by the <code>setDoInput</code> method. Its  value is returned by the <code>getDoInput</code> method.  <p> A URL connection can be used for input and/or output. Setting the  <code>doInput</code> flag to <code>true</code> indicates that  the application intends to read data from the URL connection.  <p> The default value of this field is <code>true</code>.<DD><DL><DT><B>See Also: </B><DD><A HREF="../../java/net/URLConnection.html#getDoInput()"><CODE>getDoInput()</CODE></A>, <A HREF="../../java/net/URLConnection.html#setDoInput(boolean)"><CODE>setDoInput(boolean)</CODE></A></DL></DD></DL><HR><A NAME="doOutput"><!-- --></A><H3>doOutput</H3><PRE>protected boolean <B>doOutput</B></PRE><DL><DD>This variable is set by the <code>setDoOutput</code> method. Its  value is returned by the <code>getDoInput</code> method.  <p> A URL connection can be used for input and/or output. Setting the  <code>doOutput</code> flag to <code>true</code> indicates  that the application intends to write data to the URL connection.  <p> The default value of this field is <code>false</code>.<DD><DL><DT><B>See Also: </B><DD><A HREF="../../java/net/URLConnection.html#getDoOutput()"><CODE>getDoOutput()</CODE></A>, <A HREF="../../java/net/URLConnection.html#setDoOutput(boolean)"><CODE>setDoOutput(boolean)</CODE></A></DL></DD></DL><HR><A NAME="allowUserInteraction"><!-- --></A><H3>allowUserInteraction</H3><PRE>protected boolean <B>allowUserInteraction</B></PRE><DL><DD>If <code>true</code>, this <code>URL</code> is being examined in  a context in which it makes sense to allow user interactions such  as popping up an authentication dialog. If <code>false</code>,  then no user interaction is allowed.  <p> The value of this field can be set by the  <code>setAllowUserInteraction</code> method. Its value is returned by the  <code>getAllowUserInteraction</code> method. Its default value is the value of the argument in the last invocation  of the <code>setDefaultAllowUserInteraction</code> method.<DD><DL><DT><B>See Also: </B><DD><A HREF="../../java/net/URLConnection.html#getAllowUserInteraction()"><CODE>getAllowUserInteraction()</CODE></A>, <A HREF="../../java/net/URLConnection.html#setAllowUserInteraction(boolean)"><CODE>setAllowUserInteraction(boolean)</CODE></A>, <A HREF="../../java/net/URLConnection.html#setDefaultAllowUserInteraction(boolean)"><CODE>setDefaultAllowUserInteraction(boolean)</CODE></A></DL></DD></DL><HR><A NAME="useCaches"><!-- --></A><H3>useCaches</H3><PRE>protected boolean <B>useCaches</B></PRE><DL><DD>If <code>true</code>, the protocol is allowed to use caching  whenever it can. If <code>false</code>, the protocol must always  try to get a fresh copy of the object.  <p> This field is set by the <code>setUseCaches</code> method. Its  value is returned by the <code>getUseCaches</code> method. <p> Its default value is the value given in the last invocation of the  <code>setDefaultUseCaches</code> method.<DD><DL><DT><B>See Also: </B><DD><A HREF="../../java/net/URLConnection.html#setUseCaches(boolean)"><CODE>setUseCaches(boolean)</CODE></A>, <A HREF="../../java/net/URLConnection.html#getUseCaches()"><CODE>getUseCaches()</CODE></A>, <A HREF="../../java/net/URLConnection.html#setDefaultUseCaches(boolean)"><CODE>setDefaultUseCaches(boolean)</CODE></A></DL></DD></DL><HR><A NAME="ifModifiedSince"><!-- --></A><H3>ifModifiedSince</H3><PRE>protected long <B>ifModifiedSince</B></PRE><DL><DD>Some protocols support skipping the fetching of the object unless  the object has been modified more recently than a certain time.  <p> A nonzero value gives a time as the number of milliseconds since  January 1, 1970, GMT. The object is fetched only if it has been  modified more recently than that time.  <p> This variable is set by the <code>setIfModifiedSince</code>  method. Its value is returned by the  <code>getIfModifiedSince</code> method. <p> The default value of this field is <code>0</code>, indicating  that the fetching must always occur.<DD><DL><DT><B>See Also: </B><DD><A HREF="../../java/net/URLConnection.html#getIfModifiedSince()"><CODE>getIfModifiedSince()</CODE></A>, <A HREF="../../java/net/URLConnection.html#setIfModifiedSince(long)"><CODE>setIfModifiedSince(long)</CODE></A></DL></DD></DL><HR><A NAME="connected"><!-- --></A><H3>connected</H3><PRE>protected boolean <B>connected</B></PRE><DL><DD>If <code>false</code>, this connection object has not created a  communications link to the specified URL. If <code>true</code>,  the communications link has been established.</DL>

⌨️ 快捷键说明

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