📄 jarurlconnection.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Frameset//EN""http://www.w3.org/TR/REC-html40/frameset.dtd"><!--NewPage--><HTML><HEAD><!-- Generated by javadoc on Thu Apr 27 23:35:33 PDT 2000 --><TITLE>Java 2 Platform SE v1.3: Class JarURLConnection</TITLE><LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style"></HEAD><BODY BGCOLOR="white"><!-- ========== START OF NAVBAR ========== --><A NAME="navbar_top"><!-- --></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0"><TR><TD COLSPAN=2 BGCOLOR="#EEEEFF" CLASS="NavBarCell1"><A NAME="navbar_top_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="class-use/JarURLConnection.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </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-files/index-1.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><b>Java<sup><font size=-2>TM</font></sup> 2 Platform<br>Std. Ed. v1.3</b></EM></TD></TR><TR><TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2"> <A HREF="../../java/net/InetAddress.html"><B>PREV CLASS</B></A> <A HREF="../../java/net/MulticastSocket.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="JarURLConnection.html" TARGET="_top"><B>NO FRAMES</B></A></FONT></TD></TR><TR><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2"> SUMMARY: INNER | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD><TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD></TR></TABLE><!-- =========== END OF NAVBAR =========== --><HR><!-- ======== START OF CLASS DATA ======== --><H2><FONT SIZE="-1">java.net</FONT><BR>Class JarURLConnection</H2><PRE><A HREF="../../java/lang/Object.html">java.lang.Object</A> | +--<A HREF="../../java/net/URLConnection.html">java.net.URLConnection</A> | +--<B>java.net.JarURLConnection</B></PRE><HR><DL><DT>public abstract class <B>JarURLConnection</B><DT>extends <A HREF="../../java/net/URLConnection.html">URLConnection</A></DL><P>A URL Connection to a Java ARchive (JAR) file or an entry in a JAR file. <p>The syntax of a JAR URL is: <pre> jar:<url>!/{entry} </pre> <p>for example: <p><code> jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class<br> </code> <p>Jar URLs should be used to refer to a JAR file or entries in a JAR file. The example above is a JAR URL which refers to a JAR entry. If the entry name is omitted, the URL refers to the whole JAR file: <code> jar:http://www.foo.com/bar/baz.jar!/ </code> <p>Users should cast the generic URLConnection to a JarURLConnection when they know that the URL they created is a JAR URL, and they need JAR-specific functionality. For example: <pre> URL url = new URL("jar:file:/home/duke/duke.jar!/"); JarURLConnection jarConnection = (JarURLConnection)url.openConnection(); Manifest manifest = jarConnection.getManifest(); </pre> <p>Examples: <dl> <dt>A Jar entry <dd><code>jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class</code> <dt>A Jar file <dd><code>jar:http://www.foo.com/bar/baz.jar!/</code> <dt>A Jar directory <dd><code>jar:http://www.foo.com/bar/baz.jar!/COM/foo/</code> </dl> <p><code>!/</code> is refered to as the <em>separator</em>. <p>When constructing a JAR url via <code>new URL(context, spec)</code>, the following rules apply: <ul> <li>if there is no context URL and the specification passed to the URL constructor doesn't contain a separator, the URL is considered to refer to a JarFile. <li>if there is a context URL, the context URL is assumed to refer to a JAR file or a Jar directory. <li>if the specification begins with a '/', the Jar directory is ignored, and the spec is considered to be at the root of the Jar file. <p>Examples: <dt>context: <b>jar:http://www.foo.com/bar/jar.jar!/</b>, spec:<b>baz/entry.txt</b> <dd>url:<b>jar:http://www.foo.com/bar/baz/jar.jar!/baz/entry.txt</b> <dt>context: <b>jar:http://www.foo.com/bar/jar.jar!/baz</b>, spec:<b>entry.txt</b> <dd>url:<b>jar:http://www.foo.com/bar/baz/jar.jar!/baz/entry.txt</b> <dt>context: <b>jar:http://www.foo.com/bar/jar.jar!/baz</b>, spec:<b>/entry.txt</b> <dd>url:<b>jar:http://www.foo.com/bar/baz/jar.jar!/entry.txt</b> </dl> </ul><P><DL><DT><B>Since: </B><DD>1.2</DD><DT><B>See Also: </B><DD><A HREF="../../java/net/URL.html"><CODE>URL</CODE></A>, <A HREF="../../java/net/URLConnection.html"><CODE>URLConnection</CODE></A>, <A HREF="../../java/util/jar/JarFile.html"><CODE>JarFile</CODE></A>, <A HREF="../../java/util/jar/JarInputStream.html"><CODE>JarInputStream</CODE></A>, <A HREF="../../java/util/jar/Manifest.html"><CODE>Manifest</CODE></A>, <A HREF="../../java/util/zip/ZipEntry.html"><CODE>ZipEntry</CODE></A></DL><HR><P><!-- ======== INNER CLASS SUMMARY ======== --><!-- =========== FIELD SUMMARY =========== --><A NAME="field_summary"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor"><TD COLSPAN=2><FONT SIZE="+2"><B>Field Summary</B></FONT></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>protected <A HREF="../../java/net/URLConnection.html">URLConnection</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/JarURLConnection.html#jarFileURLConnection">jarFileURLConnection</A></B></CODE><BR> The connection to the JAR file URL, if the connection has been initiated.</TD></TR></TABLE> <A NAME="fields_inherited_from_class_java.net.URLConnection"><!-- --></A><TABLE BORDER="1" CELLPADDING="3" CELLSPACING="0" WIDTH="100%"><TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor"><TD><B>Fields inherited from class java.net.<A HREF="../../java/net/URLConnection.html">URLConnection</A></B></TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD><CODE><A HREF="../../java/net/URLConnection.html#allowUserInteraction">allowUserInteraction</A>, <A HREF="../../java/net/URLConnection.html#connected">connected</A>, <A HREF="../../java/net/URLConnection.html#doInput">doInput</A>, <A HREF="../../java/net/URLConnection.html#doOutput">doOutput</A>, <A HREF="../../java/net/URLConnection.html#ifModifiedSince">ifModifiedSince</A>, <A HREF="../../java/net/URLConnection.html#url">url</A>, <A HREF="../../java/net/URLConnection.html#useCaches">useCaches</A></CODE></TD></TR></TABLE> <!-- ======== CONSTRUCTOR SUMMARY ======== --><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/JarURLConnection.html#JarURLConnection(java.net.URL)">JarURLConnection</A></B>(<A HREF="../../java/net/URL.html">URL</A> url)</CODE><BR> Creates the new JarURLConnection 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> <A HREF="../../java/util/jar/Attributes.html">Attributes</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/JarURLConnection.html#getAttributes()">getAttributes</A></B>()</CODE><BR> Return the Attributes object for this connection if the URL for it points to a JAR file entry, null otherwise.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/security/cert/Certificate.html">Certificate</A>[]</CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/JarURLConnection.html#getCertificates()">getCertificates</A></B>()</CODE><BR> Return the Certificate object for this connection if the URL for it points to a JAR file entry, null otherwise.</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/JarURLConnection.html#getEntryName()">getEntryName</A></B>()</CODE><BR> Return the entry name for this connection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE> <A HREF="../../java/util/jar/JarEntry.html">JarEntry</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/JarURLConnection.html#getJarEntry()">getJarEntry</A></B>()</CODE><BR> Return the JAR entry object for this connection, if any.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1"><CODE>abstract <A HREF="../../java/util/jar/JarFile.html">JarFile</A></CODE></FONT></TD><TD><CODE><B><A HREF="../../java/net/JarURLConnection.html#getJarFile()">getJarFile</A></B>()</CODE><BR> Return the JAR file for this connection.</TD></TR><TR BGCOLOR="white" CLASS="TableRowColor"><TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -