diff options
| author | krab <krab@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-08-18 14:16:42 +0000 |
|---|---|---|
| committer | krab <krab@138bc75d-0d04-0410-961f-82ee72b054a4> | 1999-08-18 14:16:42 +0000 |
| commit | 009022b277bdd8bc12a66677811adee7135ec042 (patch) | |
| tree | 3bcaf8f2877d654d67d3e2cc982a85a71299ca35 /libjava/gnu/gcj/protocol | |
| parent | 71a3455af48e575974a233c4174aeb50c835a469 (diff) | |
| download | ppe42-gcc-009022b277bdd8bc12a66677811adee7135ec042.tar.gz ppe42-gcc-009022b277bdd8bc12a66677811adee7135ec042.zip | |
* java/lang/natClassLoader.cc (_Jv_PrepareCompiledClass): Renamed
from _Jv_InternClassStrings.
* prims.cc (_Jv_RunMain): New function.
(JvRunMain): Remove gij-support.
* gij.cc (main): Use _Jv_RunMain.
* java/util/zip/ZipFile.java: Call readDirectory in constructor.
* interpret.cc (PUSHA, PUSHI, PUSHF, PUSHL, PUSHD): Don't store
argument in temp variable.
(continue1): For all op_x2y insns, use temp variable for
intermediate value. Also remove some comments.
* java/lang/natClass.cc (newInstance): Call _Jv_InitClass.
(forName): Don't call _Jv_InitClass.
* java/lang/Class.java (getResource,getResourceAsStream): Implement.
* java/util/zip/ZipEntry.java (ZipEntry(ZipEntry)): New construcor.
* java/util/jar/JarInputStream.java: New file.
* java/util/jar/JarEntry.java: New file.
* java/util/jar/JarFile.java: New file.
* java/net/URLClassLoader.java: New file.
* java/net/JarURLConnection.java: New file.
* gnu/gcj/protocol/jar/Handler.java: New file.
* gnu/gcj/protocol/jar/Connection.java: New file.
* java/security/SecureClassLoader.java: New file.
* java/lang/ClassLoader.java (parent): New variable.
(ClassLoader (ClassLoader)): new constructor.
(findClass): New method.
(loadClass): Add default 1.2 implementation.
(getSystemResourceAsBytes, getResourceAsBytes): Removed.
(readfully): Removed.
* gnu/gcj/runtime/VMClassLoader.java: Moved from java/lang.
(findSystemClass): New method.
(VMClassLoader): Constructor rewritten.
(init): New method.
All other methods removed.
* java/lang/natClassLoader.cc: Change use of java::lang::VMClassLoader
to gnu::gcj::runtime::VMClassLoader.
(_Jv_InternClassStrings): Use _Jv_ResolvePoolEntry. Also handle
class entries.
(VMClassLoader::findSystemClass): renamed from findBootClass.
* Makefile.am: Add new files.
(FirstThread.h, ThreadGroup.h): Add _Jv_Main friend.
* Makefile.in: Rebuilt.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@28748 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/gnu/gcj/protocol')
| -rw-r--r-- | libjava/gnu/gcj/protocol/jar/Connection.java | 86 | ||||
| -rw-r--r-- | libjava/gnu/gcj/protocol/jar/Handler.java | 29 |
2 files changed, 115 insertions, 0 deletions
diff --git a/libjava/gnu/gcj/protocol/jar/Connection.java b/libjava/gnu/gcj/protocol/jar/Connection.java new file mode 100644 index 00000000000..4d7421b2f79 --- /dev/null +++ b/libjava/gnu/gcj/protocol/jar/Connection.java @@ -0,0 +1,86 @@ +/* Copyright (C) 1999 Cygnus Solutions + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package gnu.gcj.protocol.jar; + +import java.net.URL; +import java.net.JarURLConnection; +import java.net.URLStreamHandler; +import java.net.MalformedURLException; +import java.net.ProtocolException; +import java.io.IOException; +import java.util.jar.JarFile; +import java.util.Hashtable; + +/** + * Written using on-line Java Platform 1.2 API Specification. + * Status: Needs a way to download jar files and store them in the local file + * system. I don't know how to do that in a portable way. For now, it can only handle + * connections to a jar:file: url's. + * + * @author Kresten Krab Thorup <krab@gnu.org> + * @date Aug 10, 1999. + */ + + + +public class Connection extends JarURLConnection +{ + static Hashtable file_cache = new Hashtable(); + private JarFile jarfile; + + public Connection(URL url) + throws MalformedURLException + { + super(url); + } + + public synchronized JarFile getJarFile() throws java.io.IOException + { + if (!connected) + connect(); + + if (! doInput) + throw new ProtocolException("Can't open JarFile if doInput is false"); + + if (jarfile != null) + return jarfile; + + URL jarFileURL = getJarFileURL (); + + if (jarFileURL.getProtocol ().equals ("file") + && jarFileURL.getHost ().equals ("")) + { + if (getUseCaches()) + { + jarfile = (JarFile) file_cache.get(jarFileURL); + if (jarFileURL == null) + { + jarfile = new JarFile (jarFileURL.getFile ()); + file_cache.put (jarFileURL, jarfile); + } + } + else + jarfile = new JarFile (jarFileURL.getFile ()); + } + else + { + /* + FIXME: Here we need to download and cache the jar + file in the local file system! Stupid design. Why + can't we just create a JarFile from a bag of bytes? + */ + + throw new java.io.IOException("cannot create jar file from " + + jarFileURL); + } + + return jarfile; + } + +} diff --git a/libjava/gnu/gcj/protocol/jar/Handler.java b/libjava/gnu/gcj/protocol/jar/Handler.java new file mode 100644 index 00000000000..f9feb7d9977 --- /dev/null +++ b/libjava/gnu/gcj/protocol/jar/Handler.java @@ -0,0 +1,29 @@ +// Handler.java - URLStreamHandler for file protocol. + +/* Copyright (C) 1999 Cygnus Solutions + + This file is part of libgcj. + +This software is copyrighted work licensed under the terms of the +Libgcj License. Please consult the file "LIBGCJ_LICENSE" for +details. */ + +package gnu.gcj.protocol.jar; + +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; +import java.io.IOException; + +/** + * @author Kresten Krab Thorup <krab@gnu.org> + * @date August 13, 1999. + */ + +public class Handler extends URLStreamHandler +{ + protected URLConnection openConnection(URL url) throws IOException + { + return new Connection(url); + } +} |

