public abstract class JarURLConnection extends URLConnection
一个罐子的地址的语法是:
罐子:
<网址>
!输入}
网址>
例如:
jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class
可以用来指向一个用于在一个罐子文件中的一个罐子文件或条目。上面的例子是一个是一个瓶子的网址,它是指一个罐子入口。如果输入的名称被省略,URL是指整个JAR文件:jar:http://www.foo.com/bar/baz.jar!/
用户应将通用URLConnection到jarurlconnection当他们知道URL他们创建的是一个罐子,罐子的URL,他们需要特定的功能。例如:
URL =新的URL(“罐:文件:/家/公/ duke.jar!“);jarurlconnection jarconnection =(jarurlconnection)openconnection() URL;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
连接到罐子文件的网址,如果连接已经启动。
|
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches| Modifier | Constructor and Description |
|---|---|
protected |
JarURLConnection(URL url)
创建到指定的URL的新jarurlconnection。
|
| Modifier and Type | Method and Description |
|---|---|
Attributes |
getAttributes()
返回此连接的属性对象,如果它指向一个罐子文件条目的网址,否则为空。
|
Certificate[] |
getCertificates()
返回此连接的证书对象,如果它指向一个罐子文件条目的网址,否则为空。
|
String |
getEntryName()
返回此连接的输入名称。
|
JarEntry |
getJarEntry()
返回此连接的“入瓶”对象,如果有。
|
abstract JarFile |
getJarFile()
返回此连接的“文件”文件。
|
URL |
getJarFileURL()
返回此连接的“文件”的“文件”的地址。
|
Attributes |
getMainAttributes()
返回此连接的文件的主属性。
|
Manifest |
getManifest()
返回此连接的清单,或如果没有。
|
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的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如果得到罐进入引起IOException被。
getJarEntry()
public Attributes getMainAttributes() throws IOException
IOException如果得到体现的原因被抛出IOException。
getJarFile(),
getManifest()
public Certificate[] getCertificates() throws IOException
null
IOException如果得到罐进入引起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.