|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--net.groboclown.util.classes.v1.jdk0.UrlClassLoader
Class responsible for loading classes in a JDK 1.0+ version compatible way. Need to determine speed vs. size for caching Jar files that are loaded over the internet. For now, we cache stuff, in the hope that the flush() will be called.
If the URL is null, or if the bytecode for a class name is not found, then this will attempt to load the class from the system classloader.
Inner Class Summary | |
private class |
UrlClassLoader.BytecodeSourceCache
|
private class |
UrlClassLoader.JarBytecodeSource
Loads classes from a given zip/jar file |
private class |
UrlClassLoader.UrlBytecodeSource
|
Field Summary | |
private static String[] |
JAR_EXTENTIONS
|
private ArrayClassLoader |
m_acl
|
private Hashtable |
m_urlSources
|
Constructor Summary | |
UrlClassLoader()
Default constructor |
Method Summary | |
protected String |
className2jarFileName(String className)
Converts a class name to a file name. |
protected String |
convertUrl(String url)
Converts the given string to a fully qualified URL. |
protected byte[] |
findZipEntry(String filename,
ZipInputStream zis)
Finds the entry of the given filename in the given input stream, and returns the entry as a byte array. |
void |
flush()
Call to flush any cache stored in the interface. |
protected String |
getAbsoluteFilename(File f)
|
byte[] |
getBytecode(String classname)
Loads the bytecode for the given classname. |
protected BytecodeSource |
getBytecodeSource(String url)
|
protected boolean |
isJarURL(String url)
|
protected String |
joinClassToUrl(String className,
String url)
Joins a classname to a URL. |
Class |
loadClass(String className,
String url)
Load the given class from the given URL. |
Methods inherited from class java.lang.Object |
|
Field Detail |
private ArrayClassLoader m_acl
private Hashtable m_urlSources
private static final String[] JAR_EXTENTIONS
Constructor Detail |
public UrlClassLoader()
Method Detail |
public Class loadClass(String className, String url)
loadClass
in interface IUrlClassLoader
className
- the exact class name to load.url
- the URL from which the class is loaded. If this is
null, then this loads the class from the default class
loader.public void flush()
flush
in interface IUrlClassLoader
public byte[] getBytecode(String classname)
BytecodeSource
getBytecode
in interface BytecodeSource
net.groboclown.util.classes.v1.jdk0.BytecodeSource
classname
- the name of the class to find.protected BytecodeSource getBytecodeSource(String url)
protected String convertUrl(String url)
protected boolean isJarURL(String url)
protected byte[] findZipEntry(String filename, ZipInputStream zis)
protected String className2jarFileName(String className)
protected String joinClassToUrl(String className, String url)
protected String getAbsoluteFilename(File f)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |