|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavassist.ByteArrayClassPath
public class ByteArrayClassPath
A ByteArrayClassPath
contains bytes that is served as
a class file to a ClassPool
. It is useful to convert
a byte array to a CtClass
object.
For example, if you want to convert a byte array b
into a CtClass
object representing the class with a name
classname
, then do as following:
ClassPool cp = ClassPool.getDefault(); cp.insertClassPath(new ByteArrayClassPath(classname, b)); CtClass cc = cp.get(classname);
The ClassPool
object cp
uses the created
ByteArrayClassPath
object as the source of the class file.
A ByteArrayClassPath
must be instantiated for every
class. It contains only a single class file.
ClassPath
,
ClassPool.insertClassPath(ClassPath)
,
ClassPool.appendClassPath(ClassPath)
,
ClassPool.makeClass(InputStream)
Field Summary | |
---|---|
protected byte[] |
classfile
|
protected String |
classname
|
Constructor Summary | |
---|---|
ByteArrayClassPath(String name,
byte[] classfile)
|
Method Summary | |
---|---|
void |
close()
Closes this class path. |
URL |
find(String classname)
Obtains the URL. |
InputStream |
openClassfile(String classname)
Opens the class file. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected String classname
protected byte[] classfile
Constructor Detail |
---|
public ByteArrayClassPath(String name, byte[] classfile)
Method Detail |
---|
public void close()
close
in interface ClassPath
public String toString()
toString
in class Object
public InputStream openClassfile(String classname)
openClassfile
in interface ClassPath
classname
- a fully-qualified class name
Translator
public URL find(String classname)
find
in interface ClassPath
classname
- a fully-qualified class name.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |