Package javassist
Class ByteArrayClassPath
java.lang.Object
javassist.ByteArrayClassPath
- All Implemented Interfaces:
ClassPath
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.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionObtains the URL.openClassfile
(String classname) Opens the class file.toString()
-
Constructor Details
-
ByteArrayClassPath
-
-
Method Details
-
toString
-
openClassfile
Opens the class file.- Specified by:
openClassfile
in interfaceClassPath
- Parameters:
classname
- a fully-qualified class name- Returns:
- the input stream for reading a class file
- See Also:
-
find
Obtains the URL.
-