| Constructor and Description |
|---|
URLClassPath(java.lang.String host,
int port,
java.lang.String directory,
java.lang.String packageName)
Creates a search path specified with URL (http).
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes this class path.
|
static byte[] |
fetchClass(java.lang.String host,
int port,
java.lang.String directory,
java.lang.String classname)
Reads a class file on an http server.
|
java.net.URL |
find(java.lang.String classname)
Returns the URL.
|
java.io.InputStream |
openClassfile(java.lang.String classname)
Opens a class file with http.
|
java.lang.String |
toString() |
public URLClassPath(java.lang.String host,
int port,
java.lang.String directory,
java.lang.String packageName)
This search path is used only if a requested
class name starts with the name specified by packageName.
If packageName is "org.javassist." and a requested class is
"org.javassist.test.Main", then the given URL is used for loading that class.
The URLClassPath obtains a class file from:
http://www.javassist.org:80/java/classes/org/javassist/test/Main.class
Here, we assume that host is "www.javassist.org",
port is 80, and directory is "/java/classes/".
If packageName is null, the URL is used
for loading any class.
host - host nameport - port numberdirectory - directory name ending with "/".
It can be "/" (root directory).
It must start with "/".packageName - package name. It must end with "." (dot).public java.lang.String toString()
toString in class java.lang.Objectpublic java.io.InputStream openClassfile(java.lang.String classname)
openClassfile in interface ClassPathclassname - a fully-qualified class nameTranslatorpublic java.net.URL find(java.lang.String classname)
public static byte[] fetchClass(java.lang.String host,
int port,
java.lang.String directory,
java.lang.String classname)
throws java.io.IOException
host - host nameport - port numberdirectory - directory name ending with "/".
It can be "/" (root directory).
It must start with "/".classname - fully-qualified class namejava.io.IOExceptionJavassist, a Java-bytecode translator toolkit.
Copyright (C) 1999- Shigeru Chiba. All Rights Reserved.