public abstract class JarURLConnection extends URLConnection
JAR URL的语法是:
  jar:<url>!/{entry}  
       例如:
 jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class 
 JAR URL应用于引用JAR文件或JAR文件中的条目。 上面的示例是一个引用JAR条目的JAR URL。 如果省略条目名称,则URL引用整个JAR文件: jar:http://www.foo.com/bar/baz.jar!/ 
当他们知道他们创建的URL是一个JAR URL,并且他们需要JAR特定的功能时,用户应该将通用URLConnection转换为JarURLConnection。 例如:
  URL url = new URL("jar:file:/home/duke/duke.jar!/");
 JarURLConnection jarConnection = (JarURLConnection)url.openConnection();
 Manifest manifest = jarConnection.getManifest();  
        JarURLConnection实例只能用于从JAR文件读取。 使用此类不可能获得OutputStream修改或写入底层JAR文件。 
例子:
jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class 
        jar:http://www.foo.com/bar/baz.jar!/ 
        jar:http://www.foo.com/bar/baz.jar!/COM/foo/ 
         !/被称为分离器 。 
 当通过构建一个JAR URL new URL(context, spec) ,适用下列规则: 
例子:
URL , URLConnection , JarFile , JarInputStream , Manifest , ZipEntry 
       | Modifier and Type | Field and Description | 
|---|---|
| protected URLConnection | jarFileURLConnection
              与JAR文件URL的连接,如果连接已启动。 
             | 
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches| Modifier | Constructor and Description | 
|---|---|
| protected  | JarURLConnection(URL url)
              创建新的JarURLConnection到指定的URL。 
             | 
| Modifier and Type | Method and Description | 
|---|---|
| Attributes | getAttributes()
              如果该连接的URL指向JAR文件条目,则返回此连接的Attributes对象,否则返回null。 
             | 
| Certificate[] | getCertificates()
              如果它的URL指向JAR文件条目,则返回此连接的证书对象,否则返回null。 
             | 
| String | getEntryName()
              返回此连接的条目名称。 
             | 
| JarEntry | getJarEntry()
              返回此连接的JAR条目对象(如果有)。 
             | 
| abstract JarFile | getJarFile()
              返回此连接的JAR文件。 
             | 
| URL | getJarFileURL()
              返回此连接的Jar文件的URL。 
             | 
| Attributes | getMainAttributes()
              返回此连接的JAR文件的主要属性。 
             | 
| Manifest | getManifest()
              返回此连接的清单,否则返回null。 
             | 
addRequestProperty, connect, getAllowUserInteraction, getConnectTimeout, getContent, getContent, getContentEncoding, getContentLength, getContentLengthLong, getContentType, getDate, getDefaultAllowUserInteraction, getDefaultRequestProperty, getDefaultUseCaches, getDoInput, getDoOutput, getExpiration, getFileNameMap, getHeaderField, getHeaderField, getHeaderFieldDate, getHeaderFieldInt, getHeaderFieldKey, getHeaderFieldLong, getHeaderFields, getIfModifiedSince, getInputStream, getLastModified, getOutputStream, getPermission, getReadTimeout, getRequestProperties, getRequestProperty, getURL, getUseCaches, guessContentTypeFromName, guessContentTypeFromStream, setAllowUserInteraction, setConnectTimeout, setContentHandlerFactory, setDefaultAllowUserInteraction, setDefaultRequestProperty, setDefaultUseCaches, setDoInput, setDoOutput, setFileNameMap, setIfModifiedSince, setReadTimeout, setRequestProperty, setUseCaches, toStringprotected URLConnection jarFileURLConnection
protected JarURLConnection(URL url) throws MalformedURLException
url - 网址 
           MalformedURLException - 如果在规范字符串中找不到合法协议,或者无法解析字符串。 
           public URL getJarFileURL()
public String getEntryName()
public abstract JarFile getJarFile() throws IOException
IOException - 如果在尝试连接到此连接的JAR文件时发生IOException。 
           URLConnection.connect() 
           public Manifest getManifest() throws IOException
IOException - 如果获取此连接的JAR文件将导致抛出IOException。 
           getJarFile() 
           public JarEntry getJarEntry() throws IOException
IOException - 如果获取此连接的JAR文件将导致抛出IOException。 
           getJarFile() , 
            getJarEntry() 
           public Attributes getAttributes() throws IOException
IOException - 如果获取JAR条目导致抛出IOException。 
           getJarEntry() 
           public Attributes getMainAttributes() throws IOException
IOException - 如果获取清单导致抛出IOException。 
           getJarFile() , 
            getManifest() 
           public Certificate[] getCertificates() throws IOException
null 
          IOException - 如果获取JAR条目导致抛出IOException。 
           getJarEntry() 
            Submit a bug or feature 
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
 Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.