📄 urlconnection.html
字号:
<A NAME="constructor_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Constructor Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected </CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#URLConnection(java.net.URL)">URLConnection</A></B>(<A HREF="../../java/net/URL.html">URL</A> url)</CODE><BR> Constructs a URL connection to the specified URL.</TD></TR></TABLE> <!-- ========== METHOD SUMMARY =========== --><A NAME="method_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Method Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract void</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#connect()">connect</A></B>()</CODE><BR> Opens a communications link to the resource referenced by this URL, if such a connection has not already been established.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getAllowUserInteraction()">getAllowUserInteraction</A></B>()</CODE><BR> Returns the value of the <code>allowUserInteraction</code> field for this object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getContent()">getContent</A></B>()</CODE><BR> Retrieves the contents of this URL connection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/Object.html">Object</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getContent(java.lang.Class[])">getContent</A></B>(<A HREF="../../java/lang/Class.html">Class</A>[] classes)</CODE><BR> Retrieves the contents of this URL connection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getContentEncoding()">getContentEncoding</A></B>()</CODE><BR> Returns the value of the <code>content-encoding</code> header field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getContentLength()">getContentLength</A></B>()</CODE><BR> Returns the value of the <code>content-length</code> header field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getContentType()">getContentType</A></B>()</CODE><BR> Returns the value of the <code>content-type</code> header field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getDate()">getDate</A></B>()</CODE><BR> Returns the value of the <code>date</code> header field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getDefaultAllowUserInteraction()">getDefaultAllowUserInteraction</A></B>()</CODE><BR> Returns the default value of the <code>allowUserInteraction</code> field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getDefaultRequestProperty(java.lang.String)">getDefaultRequestProperty</A></B>(<A HREF="../../java/lang/String.html">String</A> key)</CODE><BR> <B>Deprecated.</B> <I>The instance specific getRequestProperty 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> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getDefaultUseCaches()">getDefaultUseCaches</A></B>()</CODE><BR> Returns the default value of a <code>URLConnection</code>'s <code>useCaches</code> flag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getDoInput()">getDoInput</A></B>()</CODE><BR> Returns the value of this <code>URLConnection</code>'s <code>doInput</code> flag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getDoOutput()">getDoOutput</A></B>()</CODE><BR> Returns the value of this <code>URLConnection</code>'s <code>doOutput</code> flag.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getExpiration()">getExpiration</A></B>()</CODE><BR> Returns the value of the <code>expires</code> header field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>static <A HREF="../../java/net/FileNameMap.html">FileNameMap</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getFileNameMap()">getFileNameMap</A></B>()</CODE><BR> Loads filename map (a mimetable) from a data file.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getHeaderField(int)">getHeaderField</A></B>(int n)</CODE><BR> Returns the value for the <code>n</code><sup>th</sup> header field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getHeaderField(java.lang.String)">getHeaderField</A></B>(<A HREF="../../java/lang/String.html">String</A> name)</CODE><BR> Returns the name of the specified header field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getHeaderFieldDate(java.lang.String, long)">getHeaderFieldDate</A></B>(<A HREF="../../java/lang/String.html">String</A> name, long Default)</CODE><BR> Returns the value of the named field parsed as date.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> int</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getHeaderFieldInt(java.lang.String, int)">getHeaderFieldInt</A></B>(<A HREF="../../java/lang/String.html">String</A> name, int Default)</CODE><BR> Returns the value of the named field parsed as a number.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getHeaderFieldKey(int)">getHeaderFieldKey</A></B>(int n)</CODE><BR> Returns the key for the <code>n</code><sup>th</sup> header field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getIfModifiedSince()">getIfModifiedSince</A></B>()</CODE><BR> Returns the value of this object's <code>ifModifiedSince</code> field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/io/InputStream.html">InputStream</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getInputStream()">getInputStream</A></B>()</CODE><BR> Returns an input stream that reads from this open connection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> long</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getLastModified()">getLastModified</A></B>()</CODE><BR> Returns the value of the <code>last-modified</code> header field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/io/OutputStream.html">OutputStream</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getOutputStream()">getOutputStream</A></B>()</CODE><BR> Returns an output stream that writes to this connection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/security/Permission.html">Permission</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getPermission()">getPermission</A></B>()</CODE><BR> Returns a permission object representing the permission necessary to make the connection represented by this object.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getRequestProperty(java.lang.String)">getRequestProperty</A></B>(<A HREF="../../java/lang/String.html">String</A> key)</CODE><BR> Returns the value of the named general request property for this connection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/net/URL.html">URL</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getURL()">getURL</A></B>()</CODE><BR> Returns the value of this <code>URLConnection</code>'s <code>URL</code> field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> boolean</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#getUseCaches()">getUseCaches</A></B>()</CODE><BR> Returns the value of this <code>URLConnection</code>'s <code>useCaches</code> field.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected static <A HREF="../../java/lang/String.html">String</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/URLConnection.html#guessContentTypeFromName(java.lang.String)">guessContentTypeFromName</A></B>(<A HREF="../../java/lang/String.html">String</A> fname)</CODE><BR> Tries to determine the content type of an object, based on the specified "file" component of a URL.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -