|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.groboutils.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.
NOTE: As of version 1.0.0, there is no longer a dependency upon net.sourceforge.groboutils.util.io.v1
Constructor Summary | |
UrlClassLoader()
Default constructor |
Method Summary | |
protected java.lang.String |
className2jarFileName(java.lang.String className)
Converts a class name to a file name. |
protected java.lang.String |
convertUrl(java.lang.String url)
Converts the given string to a fully qualified URL. |
protected byte[] |
findZipEntry(java.lang.String filename,
java.util.zip.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 java.lang.String |
getAbsoluteFilename(java.io.File f)
|
byte[] |
getBytecode(java.lang.String classname)
Loads the bytecode for the given classname. |
protected BytecodeSource |
getBytecodeSource(java.lang.String url)
|
protected boolean |
isJarURL(java.lang.String url)
|
protected java.lang.String |
joinClassToUrl(java.lang.String className,
java.lang.String url)
Joins a classname to a URL. |
java.lang.Class |
loadClass(java.lang.String className,
java.lang.String url)
Load the given class from the given URL. |
protected byte[] |
readByteStream(java.io.InputStream is)
A re-implementation of net.groboclown.util.io.v1.ReadByteStream, to reduce the amount of inter-package dependencies. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public UrlClassLoader()
Method Detail |
public java.lang.Class loadClass(java.lang.String className, java.lang.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(java.lang.String classname)
BytecodeSource
getBytecode
in interface BytecodeSource
classname
- the name of the class to find.
protected BytecodeSource getBytecodeSource(java.lang.String url)
protected java.lang.String convertUrl(java.lang.String url)
protected boolean isJarURL(java.lang.String url)
protected byte[] findZipEntry(java.lang.String filename, java.util.zip.ZipInputStream zis)
protected java.lang.String className2jarFileName(java.lang.String className)
protected java.lang.String joinClassToUrl(java.lang.String className, java.lang.String url)
protected java.lang.String getAbsoluteFilename(java.io.File f)
protected byte[] readByteStream(java.io.InputStream is) throws java.io.IOException
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |