Class ClassReader
java.lang.Object
java.io.InputStream
java.io.ByteArrayInputStream
org.apache.axis2.description.java2wsdl.bytecode.ClassReader
- All Implemented Interfaces:
Closeable,AutoCloseable
- Direct Known Subclasses:
ParamReader
This is the class file reader for obtaining the parameter names
for declared methods in a class. The class must have debugging
attributes for us to obtain this information.
This does not work for inherited methods. To obtain parameter names for inherited methods, you must use a paramReader for the class that originally declared the method.
don't get tricky, it's the bare minimum. Instances of this class are not threadsafe -- don't share them.
-
Field Summary
Fields inherited from class java.io.ByteArrayInputStream
buf, count, mark, pos -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static Mapprotected static byte[]Loads the bytecode for a given class, by using the class's defining classloader and assuming that for a class named P.C, the bytecodes are in a resource named /P/C.class.protected static StringgetSignature(Member method, Class[] paramTypes) protected final voidReads an attributes array.voidreadCode()Reads a code attribute.protected final voidprotected final intreadInt()protected final intprotected final ClassresolveClass(int i) protected final FieldresolveField(int i) protected final MemberresolveMethod(int index) protected final org.apache.axis2.description.java2wsdl.bytecode.ClassReader.NameAndTyperesolveNameAndType(int i) protected final StringresolveUtf8(int i) protected final voidprotected voidskipFully(int n) Skips n bytes in the input stream.Methods inherited from class java.io.ByteArrayInputStream
available, close, mark, markSupported, read, read, readAllBytes, readNBytes, reset, skip, transferToMethods inherited from class java.io.InputStream
nullInputStream, read, readNBytes
-
Constructor Details
-
ClassReader
-
-
Method Details
-
getBytes
Loads the bytecode for a given class, by using the class's defining classloader and assuming that for a class named P.C, the bytecodes are in a resource named /P/C.class.- Parameters:
c- the class of interest- Returns:
- Returns a byte array containing the bytecode
- Throws:
IOException
-
findAttributeReaders
-
getSignature
-
readShort
protected final int readShort()- Returns:
- Returns the next unsigned 16 bit value.
-
readInt
protected final int readInt()- Returns:
- Returns the next signed 32 bit value.
-
skipFully
Skips n bytes in the input stream.- Throws:
IOException
-
resolveMethod
protected final Member resolveMethod(int index) throws IOException, ClassNotFoundException, NoSuchMethodException -
resolveField
protected final Field resolveField(int i) throws IOException, ClassNotFoundException, NoSuchFieldException -
resolveNameAndType
protected final org.apache.axis2.description.java2wsdl.bytecode.ClassReader.NameAndType resolveNameAndType(int i) throws IOException - Throws:
IOException
-
resolveClass
- Throws:
IOExceptionClassNotFoundException
-
resolveUtf8
- Throws:
IOException
-
readCpool
- Throws:
IOException
-
skipAttributes
- Throws:
IOException
-
readAttributes
Reads an attributes array. The elements of a class file that can contain attributes are: fields, methods, the class itself, and some other types of attributes.- Throws:
IOException
-
readCode
Reads a code attribute.- Throws:
IOException
-