站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.classfile (Classfile Reader) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.classfile/1 1.19

Package org.netbeans.modules.classfile

The org.netbeans.modules.classfile package supports direct access to a Java Virtual Machine classfile contents.

See:
          Description

Interface Summary
ByteCodes Constant definitions for the bytecodes defined in the Java Virtual Machine specification, Chapter 10.
 

Class Summary
Access A utility class defining access flags and access utility methods.
Annotation Annotation: a single annotation on a program element.
AnnotationComponent AnnotationComponent: a single annotation on a program element.
ArrayElementValue ArrayElementValue: the value portion of an annotation element that is an array of ElementValue instances.
AttributeMap Class representing a map of classfile attributes.
ClassElementValue ClassElementValue: the value part of a single element for those annotations that are a class type.
ClassFile Class representing a Java class file.
ClassName Class representing the name of a Java class.
Code The Code attribute of a method.
ConstantPool Class representing a Java class file constant pool.
ConstantPoolReader A Java class file constant pool reader.
CPClassInfo A class representing the CONSTANT_Class constant pool type.
CPDoubleInfo A class representing the CONSTANT_Double constant pool type.
CPEntry A class representing an entry in a ConstantPool.
CPFieldInfo A class representing the CONSTANT_Fieldref constant pool type.
CPFloatInfo A class representing the CONSTANT_Float constant pool type.
CPIntegerInfo A class representing the CONSTANT_Integer constant pool type.
CPInterfaceMethodInfo A class representing the CONSTANT_InterfaceMethodref constant pool type.
CPLongInfo A class representing the CONSTANT_Long constant pool type.
CPMethodInfo A class representing the CONSTANT_Methodref constant pool type.
CPNameAndTypeInfo A class representing the CONSTANT_NameAndType constant pool type.
CPStringInfo A class representing the CONSTANT_String constant pool type.
CPUTF8Info A class representing the CONSTANT_Utf8 constant pool type.
ElementValue ElementValue: the value portion of the name-value pair of a single annotation element.
EnclosingMethod A class representing the enclosing method of an inner class.
EnumElementValue EnumElementValue: a single annotation on a program element for those annotations that are enum constants.
ExceptionTableEntry An entry in the exception table of a method's code attribute.
Field Base class for variables and methods.
InnerClass An InnerClass attribute of a classfile.
LocalVariableTableEntry An entry in the local variable table of a method's code attribute.
LocalVariableTypeTableEntry An entry in the local variable type table of a method's code attribute.
Method A Java method object.
NestedElementValue NestedElementValue: an annotation on a program element that is another annotation.
Parameter A representation of a parameter to a method declaration.
PrimitiveElementValue A PrimitiveElementValue is the value portion of an annotation component that has a primitive type or String constant.
StackMapFrame A stack map frame, as defined by a StackMapTable attribute.
StackMapFrame.AppendFrame A frame type of append_frame, which means that the operand stack is empty and the current locals are the same as the locals in the previous frame, except that k additional locals are defined.
StackMapFrame.ChopFrame A frame type of chop_frame, which means that the operand stack is empty and the current locals are the same as the locals in the previous frame, except that the k last locals are absent.
StackMapFrame.FullFrame A frame type of full_frame, which declares all of its locals and stack items.
StackMapFrame.SameFrame A frame type of same_frame, which means that the frame has exactly the same locals as the previous stack map frame and that the number of stack items is zero.
StackMapFrame.SameFrameExtended A frame type of same_frame_extended, which means the frame has exactly the same locals as the previous stack map frame and that the number of stack items is zero.
StackMapFrame.SameLocals1StackItemFrame A frame type of same_locals_1_stack_item_frame, which means that the frame has exactly the same locals as the previous stack map frame and that the number of stack items is 1.
StackMapFrame.SameLocals1StackItemFrameExtended A frame type of same_locals_1_stack_item_frame_extended, which means that the frame has exactly the same locals as the previous stack map frame and that the number of stack items is 1.
Variable A Java field.
VerificationTypeInfo VerificationTypeInfo structure, which is defined as a C-like union in the Java Virtual Machine Specification, section 4.8.4, and is used to define stack map frame structures.
VerificationTypeInfo.DoubleVariableInfo A Double_variable_info type, which indicates that the location contains the verification type double.
VerificationTypeInfo.FloatVariableInfo A Float_variable_info type, which indicates that the location contains the verification type float.
VerificationTypeInfo.IntegerVariableInfo A Integer_variable_info type, which indicates that the location contains the verification type int.
VerificationTypeInfo.LongVariableInfo A Long_variable_info type, which indicates that the location contains the verification type long.
VerificationTypeInfo.NullVariableInfo A Null_variable_info type, which indicates that the location contains the verification type null.
VerificationTypeInfo.ObjectVariableInfo An Object_variable_info type, which indicates that the location contains an instance of the class referenced by the constant pool entry.
VerificationTypeInfo.TopVariableInfo A Top_variable_info type, which indicates that the local variable has the verification type top.
VerificationTypeInfo.UninitializedThisVariableInfo A UninitializedThis_variable_info type, which indicates that the location contains the verification type uninitializedThis.
VerificationTypeInfo.UninitializedVariableInfo An Uninitialized_variable_info type, which indicates that the location contains the verification type uninitialized(offset).
 

Exception Summary
InvalidClassFileAttributeException Thrown when a classfile attribute does not follow the specified format.
InvalidClassFormatException Exception thrown when a classfile with an invalid format is detected.
 

Package org.netbeans.modules.classfile Description

The org.netbeans.modules.classfile package supports direct access to a Java Virtual Machine classfile contents. All elements and attributes of a classfile are accessible from this package's API. This package only supports read-only access of classfiles at this time.

The classfile library is not actually a NetBeans module, but is only packaged as one to use NetBeans' Auto Update facility. By being packaged as a module, other (real) NetBeans modules may list it as a dependency and require a minimum version to be present on the system. The classfile library does not use any NetBeans API, only Java core API.

The classfile library has only four constructors, as the only objects that can be created by a client are ClassFile objects (one constructor takes an InputStream of classfile bytes, another takes a filename, and variants of these two constructors allow creation of Code objects to be suppressed). The ClassFile object is then queried for its elements. A ClassFile and its elements should be considered immutable, even though it may be possible to change one of its objects (if so, it's a bug).

Examples

Here is a simple example which dumps out a classfile:


    static void printClass(String classname) {
        try {
            System.out.println(new ClassFile(classname));
        } catch (IOException e) {
            System.out.println(e.toString());
            e.printStackTrace();
        }
    }

Here is an example which prints out any synthetic methods:


    static void printSyntheticMethods(InputStream in) throws IOException {
        ClassFile cf = new ClassFile(in);
        Iterator iter = cf.getMethods();
        while (iter.hasNext()) {
            Method m = (Method)iter.next();
            if (m.isSynthetic())
                 System.out.println(m.toString());
        }
    }

Related Documentation


org.netbeans.modules.classfile/1 1.19

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.