ClassLoader
Kresten Krab Thorup
krab@gnu.org
Tue Aug 10 01:30:00 GMT 1999
I started upgrading the ClassLoader to 1.2 api, since this will also
clean up the SearchPath stuff. In fact, my intention is to eliminate
it all together.
In 1.2, there is a standard class, java.net.URLClassLoader, that will
load classes form a list of URL's. My intention is to simply have the
system class loader be an almost-trivial subclass of this.
For that, I need to implement the most basic functionality of
java.util.jar, and java.net.JarURLConnection also. This is almost
done (for now I'm leaving out anything with signatures and manifests
and so on), but there is a tricky case.
It seems like JarURLConnection needs to be able to create a temporary
file containg the jar file, in case it is coming from the net. The
spec doesn't say explicitly. This is needed because JarURLConnection
needs to provide a java.util.jar.JarFile instance of it's contents,
and JarFile's only operate on RandomAccessFile's.
The question is how to do this the best way. I'd actually prefer if
the jar file would not have to be written to the file system at all.
It seems like it would be sufficient to have an in-memory
representation, and let swapping take care of the rest. The problem
is, that there is no such thing as a RandomAccessByteArrayFile, or the
like. So this is not realy a viable option.
The freedom that we do have, is to have a special subclass of JarFile
which can operate on an in-memory byte array. Or even better, perhaps
ZipFile could be rewritten such that it internally operates on an
inputstream that supports marking. Then we just need to invent such a
stream to encapsulate RandomAccessFile. What do you think?
On another issue -- I bought the book on the Java security
architecture, and it is quite complicated stuff. I wonder how we're
ever going to implemet all that so that it runs reasonably efficient.
-- Kresten
Kresten Krab Thorup, Ph.D. Candidate
c/o Yonezawa Laboratory
Department of Information Science
The University of Tokyo
7-3-1 Hongo, Bunkyo-ku, Tokyo 113 Japan
Fax: +81-(0)3-5689-4365
Phone: +81-(0)3-5841-4118
Mobile: +81-(0)90-3693-5715
More information about the Java
mailing list