javassist

Class URLClassPath

public class URLClassPath extends Object implements ClassPath

A class search-path specified with URL (http).

See Also: ClassPath insertClassPath appendClassPath

Constructor Summary
URLClassPath(String host, int port, String directory, String packageName)
Creates a search path specified with URL (http).
Method Summary
voidclose()
Closes this class path.
static byte[]fetchClass(String host, int port, String directory, String classname)
Reads a class file on an http server.
URLfind(String classname)
Returns the URL.
InputStreamopenClassfile(String classname)
Opens a class file with http.
StringtoString()

Constructor Detail

URLClassPath

public URLClassPath(String host, int port, String directory, String packageName)
Creates a search path specified with URL (http).

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:

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.

Parameters: host host name port port number directory directory name ending with "/". It can be "/" (root directory). It must start with "/". packageName package name. It must end with "." (dot).

Method Detail

close

public void close()
Closes this class path.

fetchClass

public static byte[] fetchClass(String host, int port, String directory, String classname)
Reads a class file on an http server.

Parameters: host host name port port number directory directory name ending with "/". It can be "/" (root directory). It must start with "/". classname fully-qualified class name

find

public URL find(String classname)
Returns the URL.

Returns: null if the class file could not be obtained.

openClassfile

public InputStream openClassfile(String classname)
Opens a class file with http.

Returns: null if the class file could not be found.

toString

public String toString()
Javassist, a Java-bytecode translator toolkit.
Copyright (C) 1999-2006 Shigeru Chiba. All Rights Reserved.