Commit 83f85f9c by Michael Koch Committed by Michael Koch

2003-12-02 Michael Koch <konqueror@gmx.de>

	* gnu/java/net/protocol/jar/Connection.java
	(Connection): Made class final, merged documentation with classpath.
	(file_cache): Made private.
	(jar_file): Renamed from jarfile.

From-SVN: r74178
parent 91305a1d
2003-12-02 Michael Koch <konqueror@gmx.de> 2003-12-02 Michael Koch <konqueror@gmx.de>
* gnu/java/net/protocol/jar/Connection.java
(Connection): Made class final, merged documentation with classpath.
(file_cache): Made private.
(jar_file): Renamed from jarfile.
2003-12-02 Michael Koch <konqueror@gmx.de>
* gnu/java/net/protocol/http/Connection.java * gnu/java/net/protocol/http/Connection.java
(Connection): Initialize doOutput to false; (Connection): Initialize doOutput to false;
(connect): Initialize inputStream, moved "send request" code to new (connect): Initialize inputStream, moved "send request" code to new
......
...@@ -47,29 +47,28 @@ import java.net.MalformedURLException; ...@@ -47,29 +47,28 @@ import java.net.MalformedURLException;
import java.net.ProtocolException; import java.net.ProtocolException;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.net.URLStreamHandler;
import java.util.Hashtable; import java.util.Hashtable;
import java.util.jar.JarFile; import java.util.jar.JarFile;
import java.util.zip.ZipFile; import java.util.zip.ZipFile;
/** /**
* Written using on-line Java Platform 1.2 API Specification. * This subclass of java.net.JarURLConnection models a URLConnection via
* the "jar" protocol.
* *
* @author Kresten Krab Thorup <krab@gnu.org> * @author Kresten Krab Thorup <krab@gnu.org>
* @date Aug 10, 1999.
*/ */
public class Connection extends JarURLConnection public final class Connection extends JarURLConnection
{ {
static Hashtable file_cache = new Hashtable(); private static Hashtable file_cache = new Hashtable();
private JarFile jarfile; private JarFile jar_file;
public Connection(URL url) protected Connection(URL url)
throws MalformedURLException throws MalformedURLException
{ {
super(url); super(url);
} }
public synchronized JarFile getJarFile() throws java.io.IOException public synchronized JarFile getJarFile() throws IOException
{ {
if (!connected) if (!connected)
connect(); connect();
...@@ -77,8 +76,8 @@ public class Connection extends JarURLConnection ...@@ -77,8 +76,8 @@ public class Connection extends JarURLConnection
if (! doInput) if (! doInput)
throw new ProtocolException("Can't open JarFile if doInput is false"); throw new ProtocolException("Can't open JarFile if doInput is false");
if (jarfile != null) if (jar_file != null)
return jarfile; return jar_file;
URL jarFileURL = getJarFileURL(); URL jarFileURL = getJarFileURL();
...@@ -87,15 +86,15 @@ public class Connection extends JarURLConnection ...@@ -87,15 +86,15 @@ public class Connection extends JarURLConnection
{ {
if (getUseCaches()) if (getUseCaches())
{ {
jarfile = (JarFile) file_cache.get(jarFileURL); jar_file = (JarFile) file_cache.get (jarFileURL);
if (jarfile == null) if (jar_file == null)
{ {
jarfile = new JarFile (jarFileURL.getFile()); jar_file = new JarFile (jarFileURL.getFile());
file_cache.put (jarFileURL, jarfile); file_cache.put (jarFileURL, jar_file);
} }
} }
else else
jarfile = new JarFile (jarFileURL.getFile()); jar_file = new JarFile (jarFileURL.getFile());
} }
else else
{ {
...@@ -111,10 +110,10 @@ public class Connection extends JarURLConnection ...@@ -111,10 +110,10 @@ public class Connection extends JarURLConnection
// Always verify the Manifest, open read only and delete when done. // Always verify the Manifest, open read only and delete when done.
// XXX ZipFile.OPEN_DELETE not yet implemented. // XXX ZipFile.OPEN_DELETE not yet implemented.
// jf = new JarFile(f, true, ZipFile.OPEN_READ | ZipFile.OPEN_DELETE); // jf = new JarFile(f, true, ZipFile.OPEN_READ | ZipFile.OPEN_DELETE);
jarfile = new JarFile(f, true, ZipFile.OPEN_READ); jar_file = new JarFile (f, true, ZipFile.OPEN_READ);
} }
return jarfile; return jar_file;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment