FileDocCategorySizeDatePackage
JMethod.javaAPI DocphoneME MR2 API (J2ME)3627Wed May 02 18:00:40 BST 2007com.sun.satsa.jcrmic.classfile

JMethod

public class JMethod extends Object
This class represents a method.

Fields Summary
private String
method_name
Method name.
private String
descriptor
Method descriptor.
private int
access_flags
Method access flags.
private com.sun.satsa.jcrmic.classfile.constants.JConstantPool
constant_pool
Constant pool reference.
private String[]
exceptionsThrown
The names of exceptions declared in the throw clause
Constructors Summary
public JMethod(com.sun.satsa.jcrmic.classfile.constants.JConstantPool constant_pool)
Constructor.

param
constant_pool constant pool reference

        this.constant_pool = constant_pool;
    
Methods Summary
public java.lang.String[]getExceptionsThrown()
Returns the list of names of exceptions declared in the throw clause.

return
the list of names of exceptions declared in the throw clause

        return exceptionsThrown;
    
public java.lang.StringgetMethodDescriptor()
Returns method descriptor.

return
method descriptor

        return descriptor;
    
public java.lang.StringgetMethodName()
Returns method name.

return
method name

        return method_name;
    
public voidparse(java.io.DataInputStream dis)
Parse and resolve Java method.

param
dis input sream
throws
IOException if I/O error occurs


        access_flags = dis.readUnsignedShort();
        int name_index = dis.readUnsignedShort();
        int descriptor_index = dis.readUnsignedShort();
        int attribute_count = dis.readUnsignedShort();
        for (int i = 0; i < attribute_count; i++) {
            int index = dis.readUnsignedShort();
            JAttribute attribute = JAttribute.create(constant_pool, index);
            attribute.parse(dis);
            if (attribute instanceof JExceptionsAttr) {
                attribute.resolve();
                exceptionsThrown = ((JExceptionsAttr)
                                        attribute).getExceptions();
            }
        }

        method_name = constant_pool.getConstantUtf8(name_index).getString();
        descriptor = constant_pool.getConstantUtf8(
                                        descriptor_index).getString();