Connection.java (getJarFile): download and cache remote jar files.

* gnu/gcj/protocol/jar/Connection.java (getJarFile): download and
	cache remote jar files.
	* gnu/gcj/runtime/VMClassLoader.java: Don't construct jar URL, only
	add File.separator to URL when it is a directory.
	* java/lang/ClassLoader.java: Add Classpath javadoc.
	(parent): final.
	(getParent): Add (disabled) security check.
	(findLibrary): New default method.
	* java/net/JarURLConnection.java (getManifest): Implement.
	(getInputStream): Only create InputStream when entry exists.
	(getHeaders): Only use jarFileURLConnection or JarEntry to set length
	when they exist.
	* java/net/URLClassLoader.java: New/Rewritten version from Classpath.

From-SVN: r59949
This commit is contained in:
Mark Wielaard 2002-12-09 00:04:00 +00:00 committed by Mark Wielaard
parent 24632117ce
commit e825ca7ff5
6 changed files with 1099 additions and 365 deletions

View file

@ -134,7 +134,11 @@ public abstract class JarURLConnection extends URLConnection
if (jarfile != null)
{
// this is the easy way...
return jarfile.getInputStream (jarfile.getEntry (element));
ZipEntry entry = jarfile.getEntry(element);
if (entry != null)
return jarfile.getInputStream (entry);
else
return null;
}
else
{
@ -320,12 +324,17 @@ public abstract class JarURLConnection extends URLConnection
// to add others later and for consistency, we'll implement it this way.
// Add the only header we know about right now: Content-length.
long len;
long len = -1;
if (element == null)
len = jarFileURLConnection.getContentLength ();
if (jarFileURLConnection != null)
len = jarFileURLConnection.getContentLength ();
else
len = getJarEntry ().getSize ();
{
JarEntry entry = getJarEntry();
if (entry != null)
len = entry.getSize ();
}
String line = "Content-length: " + len;
hdrVec.addElement(line);
@ -381,7 +390,6 @@ public abstract class JarURLConnection extends URLConnection
{
JarFile file = getJarFile ();
// FIXME: implement this
return null;
return (file != null) ? file.getManifest() : null;
}
}