classUtils.javassist
Class URLClassPath

java.lang.Object
  extended by classUtils.javassist.URLClassPath
All Implemented Interfaces:
ClassPath

public class URLClassPath
extends java.lang.Object
implements ClassPath

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

See Also:
ClassPath, ClassPool.insertClassPath(ClassPath), ClassPool.appendClassPath(ClassPath)

Constructor Summary
URLClassPath(java.lang.String host, int port, java.lang.String directory, java.lang.String packageName)
          Creates a search path specified with URL (http).
 
Method Summary
 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.io.InputStream openClassfile(java.lang.String classname)
          Opens a class file with http.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

URLClassPath

public URLClassPath(java.lang.String host,
                    int port,
                    java.lang.String directory,
                    java.lang.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 "mypack" and a requested class is "mypack.sub.Test", then the given URL is used for loading that class. 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).
packageName - package name.
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

openClassfile

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

Specified by:
openClassfile in interface ClassPath
Parameters:
classname - a fully-qualified class name
Returns:
the input stream for reading a class file
See Also:
Translator

close

public void close()
Closes this class path.

Specified by:
close in interface ClassPath

fetchClass

public static byte[] fetchClass(java.lang.String host,
                                int port,
                                java.lang.String directory,
                                java.lang.String classname)
                         throws java.io.IOException
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).
classname - fully-qualified class name
Throws:
java.io.IOException