Top Description Fields Constructors Methods
javassist

public Class URLClassPath

extends Object
implements ClassPath
Class Inheritance
All Implemented Interfaces
javassist.ClassPath
Imports
java.io.IOException, .InputStream, java.net.MalformedURLException, .URL, .URLConnection

A class search-path specified with URL (http).
See Also
javassist.ClassPath, ClassPool#insertClassPath(ClassPath), ClassPool#appendClassPath(ClassPath)

Field Summary

Modifier and TypeField and Description
protected String
protected String
protected String
protected int

Constructor Summary

AccessConstructor and Description
public
URLClassPath(String
host name
host
,
int
port number
port
,
String
directory name ending with "/". It can be "/" (root directory). It must start with "/".
directory
,
String
package name. It must end with "." (dot).
packageName
)

Creates a search path specified with URL (http).

Method Summary

Modifier and TypeMethod and Description
public static byte[]
fetchClass(String
host name
host
,
int
port number
port
,
String
directory name ending with "/". It can be "/" (root directory). It must start with "/".
directory
,
String
fully-qualified class name
classname
)

Reads a class file on an http server.

private static URLConnection
fetchClass0(String host, int port, String filename)

public URL

Returns:

null if the class file could not be obtained.
find
(String
a fully-qualified class name.
classname
)

Implements javassist.ClassPath.find.

Returns the URL.

public InputStream

Returns:

null if the class file could not be found.
openClassfile
(String
a fully-qualified class name
classname
)

Implements javassist.ClassPath.openClassfile.

Opens a class file with http.

private URLConnection
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

directoryback to summary
protected String directory
hostnameback to summary
protected String hostname
packageNameback to summary
protected String packageName
portback to summary
protected int port

Constructor Detail

URLClassPathback to summary
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:

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.

Parameters
host:String

host name

port:int

port number

directory:String

directory name ending with "/". It can be "/" (root directory). It must start with "/".

packageName:String

package name. It must end with "." (dot).

Method Detail

fetchClassback to summary
public static byte[] fetchClass(String host, int port, String directory, String classname) throws IOException

Reads a class file on an http server.

Parameters
host:String

host name

port:int

port number

directory:String

directory name ending with "/". It can be "/" (root directory). It must start with "/".

classname:String

fully-qualified class name

fetchClass0back to summary
private static URLConnection fetchClass0(String host, int port, String filename) throws IOException
findback to summary
public URL find(String classname)

Implements javassist.ClassPath.find.

Returns the URL.

Parameters
classname:String

Doc from javassist.ClassPath.find.

a fully-qualified class name.

Returns:URL

null if the class file could not be obtained.

Annotations
@Override
openClassfileback to summary
public InputStream openClassfile(String classname)

Implements javassist.ClassPath.openClassfile.

Opens a class file with http.

Parameters
classname:String

Doc from javassist.ClassPath.openClassfile.

a fully-qualified class name

Returns:InputStream

null if the class file could not be found.

Annotations
@Override
openClassfile0back to summary
private URLConnection openClassfile0(String classname) throws IOException
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override