public class ClassFileReader extends Object
Modifier and Type | Method and Description |
---|---|
static void |
main(String[] args)
Test method.
|
static ClassFile |
readFromClassPath(String[] classPath,
String packageName,
String className)
Looks up a class file in the specified class path and converts it
to a ClassFile structure.
|
static ClassFile |
readFromFile(File file)
Converts a class file to a ClassFile structure.
|
static ClassFile |
readFromInputStream(InputStream is)
Converts a class file to a ClassFile structure.
|
public static ClassFile readFromClassPath(String[] classPath, String packageName, String className) throws InvalidByteCodeException, IOException
classPath
- the class path from which to read the ClassFile structurepackageName
- the name of the package in which the class residesclassName
- the simple name of the classInvalidByteCodeException
- if the code is invalidIOException
- if an exception occurs while reading the filepublic static ClassFile readFromFile(File file) throws InvalidByteCodeException, IOException
file
- the file from which to read the ClassFile structureInvalidByteCodeException
- if the code is invalidIOException
- if an exception occurs while reading the filepublic static ClassFile readFromInputStream(InputStream is) throws InvalidByteCodeException, IOException
is
- the input stream from which to read the
ClassFile structureInvalidByteCodeException
- if the code is invalidIOException
- if an exception occurs while reading from
the input stream