|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
java.lang.Objectjava.net.URLConnection
java.net.JarURLConnection
public abstract class 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 のエントリを参照する 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/
!/ は、区切り文字です。
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 オブジェクト、そうでない場合は null を返します。 |
String |
getEntryName()
この接続のエントリ名を返します。 |
JarEntry |
getJarEntry()
この接続の JAR エントリオブジェクトが存在する場合にそれを返します。 |
abstract JarFile |
getJarFile()
この接続の JAR ファイルを返します。 |
URL |
getJarFileURL()
この接続で使う JAR ファイルの URL を返します。 |
Attributes |
getMainAttributes()
この接続で使う JAR ファイルの主要な Attributes を返します。 |
Manifest |
getManifest()
この接続の Manifest が存在する場合はそれを、存在しない場合は null を、それぞれ返します。 |
| クラス java.lang.Object から継承されたメソッド |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| フィールドの詳細 |
|---|
protected 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 - JAR エントリの取得時に IOException がスローされた場合getJarEntry()
public Attributes getMainAttributes()
throws IOException
IOException - マニフェストの取得時に IOException がスローされた場合getJarFile(),
getManifest()
public Certificate[] getCertificates()
throws IOException
null を返します。
IOException - JAR エントリの取得時に IOException がスローされた場合getJarEntry()
|
JavaTM Platform Standard Ed. 6 |
|||||||||
| 前のクラス 次のクラス | フレームあり フレームなし | |||||||||
| 概要: 入れ子 | フィールド | コンストラクタ | メソッド | 詳細: フィールド | コンストラクタ | メソッド | |||||||||
Copyright 2009 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Documentation Redistribution Policy も参照してください。