org.apache.axis.utils.bytecode

Class ClassReader

public class ClassReader extends ByteArrayInputStream

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.

Author: Edwin Smith, Macromedia

Constructor Summary
protected ClassReader(byte[] buf, Map attrMethods)
Method Summary
protected static MapfindAttributeReaders(Class c)
protected static byte[]getBytes(Class c)
load 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 voidreadAttributes()
read 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.
voidreadCode()
read a code attribute
protected voidreadCpool()
protected intreadInt()
protected intreadShort()
protected ClassresolveClass(int i)
protected FieldresolveField(int i)
protected MemberresolveMethod(int index)
protected ClassReader.NameAndTyperesolveNameAndType(int i)
protected StringresolveUtf8(int i)
protected voidskipAttributes()
protected voidskipFully(int n)
skip n bytes in the input stream.

Constructor Detail

ClassReader

protected ClassReader(byte[] buf, Map attrMethods)

Method Detail

findAttributeReaders

protected static Map findAttributeReaders(Class c)

getBytes

protected static byte[] getBytes(Class c)
load 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: a byte array containing the bytecode

Throws: IOException

getSignature

protected static String getSignature(Member method, Class[] paramTypes)

readAttributes

protected final void readAttributes()
read 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.

readCode

public void readCode()
read a code attribute

Throws: IOException

readCpool

protected final void readCpool()

readInt

protected final int readInt()

Returns: the next signed 32 bit value

readShort

protected final int readShort()

Returns: the next unsigned 16 bit value

resolveClass

protected final Class resolveClass(int i)

resolveField

protected final Field resolveField(int i)

resolveMethod

protected final Member resolveMethod(int index)

resolveNameAndType

protected final ClassReader.NameAndType resolveNameAndType(int i)

resolveUtf8

protected final String resolveUtf8(int i)

skipAttributes

protected final void skipAttributes()

skipFully

protected void skipFully(int n)
skip n bytes in the input stream.
Copyright B) 2005 Apache Web Services Project. All Rights Reserved.