|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Object
|
+--java.net.URLConnection
|
+--java.net.JarURLConnection
JAR (Java ARchive) ファイル、または JAR ファイル内にあるエントリへの URL 接続です。
JAR URL の構文は、次のとおりです。
jar:<url>!/{entry}
例:
jar:http://www.foo.com/bar/baz.jar!/COM/foo/Quux.class
Jar URL は、JAR ファイルへの参照、あるいは JAR ファイルのエントリへの参照のどちらにも使えます。上記に示した例は JAR エントリを参照しています。エントリ名が省略された場合、URL は JAR ファイルの全体を参照します。
jar:http://www.foo.com/bar/baz.jar!/
JAR URL を作成するのが明白な場合、JAR 特有の機能が必要なときは、汎用 URLConnection を JarURLConnection にキャストしてください。次に例を示します。
URL url = new URL("jar:file:/home/duke/duke.jar!/");
JarURLConnection jarConnection = (JarURLConnection)url.openConnection();
Manifest manifest = jarConnection.getManifest();
例:
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/
!/ は、区切り文字です。
new URL(context, spec) を使った JAR url の作成では、以下の規則が適用されます。
例:
URL,
URLConnection,
JarFile,
JarInputStream,
Manifest,
ZipEntry| フィールドの概要 | |
protected URLConnection |
jarFileURLConnection
接続が開始された場合の、JAR ファイル URL への接続です。 |
| クラス java.net.URLConnection から継承したフィールド |
allowUserInteraction, connected, doInput, doOutput, ifModifiedSince, url, useCaches |
| コンストラクタの概要 | |
protected |
JarURLConnection(URL url)
指定した URL に新しい JarURLConnection を作成します。 |
| メソッドの概要 | |
Attributes |
getAttributes()
接続で使う URL が JAR ファイルエントリを指す場合、この接続用の Attributes オブジェクトを返します。 |
Certificate[] |
getCertificates()
接続で使う URL が JAR ファイルエントリを指す場合に、この接続用の Certificate オブジェクトを返します。 |
String |
getEntryName()
この接続で使うエントリ名を返します。 |
JarEntry |
getJarEntry()
この接続で使う JAR エントリオブジェクトがあれば、それを返します。 |
abstract JarFile |
getJarFile()
この接続で使う JAR ファイルを返します。 |
URL |
getJarFileURL()
この接続で使う JAR ファイルの URL を返します。 |
Attributes |
getMainAttributes()
この接続で使う JAR ファイルの主要な Attributes を返します。 |
Manifest |
getManifest()
この接続で使うマニフェストがあればそれを返し、なければ null を返します。 |
| クラス java.lang.Object から継承したメソッド |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| フィールドの詳細 |
protected URLConnection jarFileURLConnection
| コンストラクタの詳細 |
protected JarURLConnection(URL url)
throws MalformedURLException
url - URLMalformedURLException - 指定文字列に有効なプロトコルが見つからない場合、または文字列を解析できない場合| メソッドの詳細 |
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()
|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 内部クラス | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Java、Java 2D、JDBC は、米国およびその他の国における米国 Sun Microsystems, Inc. の商標もしくは登録商標です。
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.